Access denied when creating a Python file?
It's trying to create a file in the system installation of Python (i.e. it's going in the root Library folder). That folder is only writeable by root (to prevent damaging important system files), hence why you're getting a permission error.

Running the command with sudo preceding it, i.e. sudo foo bar will give you the proper permissions, after asking for your password. Alternatively, you can use virtualenv to set up your own Python environment that will allow you to mess around without worrying about changing the system default install.