You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi. I'm very new to python (currently a lead ios dev) and have little experience in debugging (beyond google). I am trying to run the rgb-to-gif.py script on a pi zero w (headless). Building, earlier on, i used the make I2C_MODE=RPI method. I believe it is using python2.7 by default.
When I try to run it, I just end up hitting this error, which i'm having trouble finding help with elsewhere on the ole' internet.
I've literally changed nothing in the code, and it looks like I successfully built the rawrgb correctly. But if no one else is having this issue, I would suggest i've skimmed over an important detail somewhere 🤔
Traceback (most recent call last):
File "rgb-to-gif.py", line 43, in<module>
with subprocess.Popen(["sudo", RAW_RGB_PATH, "{}".format(fps)], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) as camera:
AttributeError: __exit__
Thanks
The text was updated successfully, but these errors were encountered:
This is an obtuse error and no mistake. Python classes are supposed to define __enter__ and __exit__ methods which allow for with X as Y: to work. __enter__ is called at the start of the with, and __exit__ is called when it goes out of scope.
It's possible that in Python 2.x these attributes aren't defined on subprocess.Popen. In fact this very bug is described here: https://bugs.python.org/issue13202
Looks like context management support (the __enter__ and __exit__ methods) was not added to subprocess.Popen until Python 3.2.
Solution: make sure you're running with Python 3, which is the default language this should be built against, the the default interpreter when you run the file as ./rgb-to-gif.py without explicitly specifying python.
Since Python 2.x is now end of life I'll tag this as a notice to anyone running into the same issue.
Hi. I'm very new to python (currently a lead ios dev) and have little experience in debugging (beyond google). I am trying to run the
rgb-to-gif.py
script on a pi zero w (headless). Building, earlier on, i used themake I2C_MODE=RPI
method. I believe it is using python2.7 by default.When I try to run it, I just end up hitting this error, which i'm having trouble finding help with elsewhere on the ole' internet.
I've literally changed nothing in the code, and it looks like I successfully built the
rawrgb
correctly. But if no one else is having this issue, I would suggest i've skimmed over an important detail somewhere 🤔Thanks
The text was updated successfully, but these errors were encountered: