1
\$\begingroup\$

I am attempting to control WS2812b LEDs using a raspberry pi according to this guide: https://tutorials-raspberrypi.com/connect-control-raspberry-pi-ws2812-rgb-led-strips/

So far I executed the following lines in terminal without any issue:

git clone https://github.com/jgarff/rpi_ws281x
cd rpi_ws281x/
sudo scons
cd python

However when I try to execute the next couple of lines, I receive errors:

pi@raspberrypi:~/rpi_ws281x/python $ python setup.py build
Extracting in /tmp/tmpMzL9XM
Traceback (most recent call last):
  File "setup.py", line 4, in <module>
    use_setuptools()
  File "/home/pi/rpi_ws281x/python/ez_setup.py", line 161, in use_setuptools
    return _do_download(version, download_base, to_dir, download_delay)
  File "/home/pi/rpi_ws281x/python/ez_setup.py", line 120, in _do_download
    _build_egg(egg, archive, to_dir)
  File "/home/pi/rpi_ws281x/python/ez_setup.py", line 62, in _build_egg
    with archive_context(archive_filename):
  File "/usr/lib/python2.7/contextlib.py", line 17, in __enter__
    return self.gen.next()
  File "/home/pi/rpi_ws281x/python/ez_setup.py", line 100, in archive_context
    with ContextualZipFile(filename) as archive:
  File "/home/pi/rpi_ws281x/python/ez_setup.py", line 88, in __new__
    return zipfile.ZipFile(*args, **kwargs)
  File "/usr/lib/python2.7/zipfile.py", line 770, in __init__
    self._RealGetContents()
  File "/usr/lib/python2.7/zipfile.py", line 811, in _RealGetContents
    raise BadZipfile, "File is not a zip file"
zipfile.BadZipfile: File is not a zip file
pi@raspberrypi:~/rpi_ws281x/python $ python setup.py install
Extracting in /tmp/tmplrNAMs
Traceback (most recent call last):
  File "setup.py", line 4, in <module>
    use_setuptools()
  File "/home/pi/rpi_ws281x/python/ez_setup.py", line 161, in use_setuptools
    return _do_download(version, download_base, to_dir, download_delay)
  File "/home/pi/rpi_ws281x/python/ez_setup.py", line 120, in _do_download
    _build_egg(egg, archive, to_dir)
  File "/home/pi/rpi_ws281x/python/ez_setup.py", line 62, in _build_egg
    with archive_context(archive_filename):
  File "/usr/lib/python2.7/contextlib.py", line 17, in __enter__
    return self.gen.next()
  File "/home/pi/rpi_ws281x/python/ez_setup.py", line 100, in archive_context
    with ContextualZipFile(filename) as archive:
  File "/home/pi/rpi_ws281x/python/ez_setup.py", line 88, in __new__
    return zipfile.ZipFile(*args, **kwargs)
  File "/usr/lib/python2.7/zipfile.py", line 770, in __init__
    self._RealGetContents()
  File "/usr/lib/python2.7/zipfile.py", line 811, in _RealGetContents
    raise BadZipfile, "File is not a zip file"
zipfile.BadZipfile: File is not a zip file

Does anyone have any idea on what I should do?

\$\endgroup\$
  • \$\begingroup\$ Did you try this??. How is this an EE question!!? \$\endgroup\$ – charansai Apr 17 '18 at 12:48
  • \$\begingroup\$ Because this is not a coding question, duh. \$\endgroup\$ – Wet Feet Apr 17 '18 at 14:03
  • \$\begingroup\$ Verify that the GPIO's are turning on or off with a volt meter. Post a schematic \$\endgroup\$ – laptop2d Jun 25 '18 at 15:22
  • \$\begingroup\$ Next time, consider posting questions about RPi-specific software at raspberrypi.stackexchange.com \$\endgroup\$ – Dmitry Grigoryev Jun 26 '18 at 8:15
1
\$\begingroup\$

Found the error, the guides assumes RPis operating with python 3 by default, even though my RPi is using python 2. To fix execute python3 setup.py build and so on instead of python setup.py build.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.