Setup.py fails

Hi

setup.py and import BrickPi failing!

When I run `sudo python setup.py install I get:

`SyntaxError: (‘invalid syntax’, (‘build/bdist.linux-armv6l/egg/BrickPi.py’, 139, 2, ‘=======n’))

creating build/bdist.linux-armv6l/egg/EGG-INFO
copying BrickPi.egg-info/PKG-INFO -> build/bdist.linux-armv6l/egg/EGG-INFO
copying BrickPi.egg-info/SOURCES.txt -> build/bdist.linux-armv6l/egg/EGG-INFO
copying BrickPi.egg-info/dependency_links.txt -> build/bdist.linux-armv6l/egg/EGG-INFO
copying BrickPi.egg-info/requires.txt -> build/bdist.linux-armv6l/egg/EGG-INFO
copying BrickPi.egg-info/top_level.txt -> build/bdist.linux-armv6l/egg/EGG-INFO
zip_safe flag not set; analyzing archive contents…
creating ‘dist/BrickPi-0.0.0-py2.7.egg’ and adding ‘build/bdist.linux-armv6l/egg’ to it
removing ‘build/bdist.linux-armv6l/egg’ (and everything under it)
Processing BrickPi-0.0.0-py2.7.egg
Removing /usr/local/lib/python2.7/dist-packages/BrickPi-0.0.0-py2.7.egg
Copying BrickPi-0.0.0-py2.7.egg to /usr/local/lib/python2.7/dist-packages
BrickPi 0.0.0 is already the active version in easy-install.pth

Installed /usr/local/lib/python2.7/dist-packages/BrickPi-0.0.0-py2.7.egg

And in Python when I try 'import BrickPi I get:

'>>> import BrickPi
Traceback (most recent call last):
File “<stdin>”, line 1, in <module>
File “/usr/local/lib/python2.7/dist-packages/BrickPi-0.0.0-py2.7.egg/BrickPi.py”, line 139
=======
^
SyntaxError: invalid syntax
>>>

I’ve followed all the instructions including os updates. What’s wrong?

So I’ve removed the ===== from BrickPi.py and I can import into python, not sure if it works with code yet.

But sudo python setup.py install fails with:

sudo python setup.py install
running install
running bdist_egg
running egg_info
writing requirements to BrickPi.egg-info/requires.txt
writing BrickPi.egg-info/PKG-INFO
writing top-level names to BrickPi.egg-info/top_level.txt
writing dependency_links to BrickPi.egg-info/dependency_links.txt
writing requirements to BrickPi.egg-info/requires.txt
writing BrickPi.egg-info/PKG-INFO
writing top-level names to BrickPi.egg-info/top_level.txt
writing dependency_links to BrickPi.egg-info/dependency_links.txt
reading manifest file 'BrickPi.egg-info/SOURCES.txt’
writing manifest file 'BrickPi.egg-info/SOURCES.txt’
installing library code to build/bdist.linux-armv6l/egg
running install_lib
running build_py
copying BrickPi.py -> build/lib.linux-armv6l-2.7
creating build/bdist.linux-armv6l/egg
copying build/lib.linux-armv6l-2.7/BrickPi.py -> build/bdist.linux-armv6l/egg
byte-compiling build/bdist.linux-armv6l/egg/BrickPi.py to BrickPi.pyc
creating build/bdist.linux-armv6l/egg/EGG-INFO
copying BrickPi.egg-info/PKG-INFO -> build/bdist.linux-armv6l/egg/EGG-INFO
copying BrickPi.egg-info/SOURCES.txt -> build/bdist.linux-armv6l/egg/EGG-INFO
copying BrickPi.egg-info/dependency_links.txt -> build/bdist.linux-armv6l/egg/EGG-INFO
copying BrickPi.egg-info/requires.txt -> build/bdist.linux-armv6l/egg/EGG-INFO
copying BrickPi.egg-info/top_level.txt -> build/bdist.linux-armv6l/egg/EGG-INFO
zip_safe flag not set; analyzing archive contents…
creating ‘dist/BrickPi-0.0.0-py2.7.egg’ and adding ‘build/bdist.linux-armv6l/egg’ to it
removing ‘build/bdist.linux-armv6l/egg’ (and everything under it)
Processing BrickPi-0.0.0-py2.7.egg
Removing /usr/local/lib/python2.7/dist-packages/BrickPi-0.0.0-py2.7.egg
Copying BrickPi-0.0.0-py2.7.egg to /usr/local/lib/python2.7/dist-packages
BrickPi 0.0.0 is already the active version in easy-install.pth

Installed /usr/local/lib/python2.7/dist-packages/BrickPi-0.0.0-py2.7.egg
Processing dependencies for BrickPi==0.0.0
Traceback (most recent call last):
File “setup.py”, line 14, in <module>
install_requires=open(‘requirements.txt’).readlines(),
File “/usr/lib/python2.7/distutils/core.py”, line 152, in setup
dist.run_commands()
File “/usr/lib/python2.7/distutils/dist.py”, line 953, in run_commands
self.run_command(cmd)
File “/usr/lib/python2.7/distutils/dist.py”, line 972, in run_command
cmd_obj.run()
File “build/bdist.linux-armv6l/egg/setuptools/command/install.py”, line 73, in run
File “build/bdist.linux-armv6l/egg/setuptools/command/install.py”, line 101, in do_egg_install
File “build/bdist.linux-armv6l/egg/setuptools/command/easy_install.py”, line 373, in run

File “build/bdist.linux-armv6l/egg/setuptools/command/easy_install.py”, line 597, in easy_install

File “build/bdist.linux-armv6l/egg/setuptools/command/easy_install.py”, line 648, in install_item

File “build/bdist.linux-armv6l/egg/setuptools/command/easy_install.py”, line 699, in process_distribution

File “build/bdist.linux-armv6l/egg/pkg_resources.py”, line 600, in resolve

File “build/bdist.linux-armv6l/egg/pkg_resources.py”, line 2440, in requires

File “build/bdist.linux-armv6l/egg/pkg_resources.py”, line 2425, in _dep_map
pass
File “build/bdist.linux-armv6l/egg/pkg_resources.py”, line 2915, in split_sections

File “build/bdist.linux-armv6l/egg/pkg_resources.py”, line 2112, in yield_lines
match = EGG_NAME(basename)
File “build/bdist.linux-armv6l/egg/pkg_resources.py”, line 2454, in _get_metadata
strs must be an instance of basestring, or a (possibly-nested)
File “build/bdist.linux-armv6l/egg/pkg_resources.py”, line 1371, in get_metadata_lines
raise NotImplementedError(
File “build/bdist.linux-armv6l/egg/pkg_resources.py”, line 1363, in get_metadata
if fspath.startswith(self.egg_root+os.sep):
File “build/bdist.linux-armv6l/egg/pkg_resources.py”, line 1428, in _get
# size and stamp match, somebody did it just ahead of
zipimport.ZipImportError: bad local file header in /usr/local/lib/python2.7/dist-packages/BrickPi-0.0.0-py2.7.egg

The sample programs run:-)

So the only problem is line 139 containing ===== in all the copies of BrickPi.py.

Hey Mike, thanks so much for pointing this out. I think we got some garbage on our last update.

I’ve just repushed hopefully cleaned it up.