I've been trying to learn Python via "Learn Python the Hard Way", and in ex46 he told us to put a script in bin and install it with setup.py.
My script name was script1.py Here is my setup.py file:
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
config = [
'description': 'My Project',
'author': 'My Name',
'url': 'URL to get it at.',
'download_url': 'Where to download it.',
'author_email': 'My email.',
'version': '0.1',
'install_requires': ['nose'],
'packages': ['NAME'],
'scripts': ['bin/script1.py'],
'name': 'projectname'
]
setup(**config)
Output:
File "setup.py", line 7
'description': 'My Project',
^
SyntaxError: invalid syntax
Your description is shown as a list (begins and ends with [
and ]
) but should be a dict (begin and end with {
and }
).
A list is just that, a comma separated list of items, the start and end of which are indicated by brackets ([
and ]
). A dict on the other hand is a comma separated list of key/value pairs which are indicated by braces({
and }
). The error is telling you that the colon (which would separate a dictionary's key from its value) is out of place since it thinks it is a list. By changing the beginning and ending brackets to braces, it will properly identify it as a dictionary.