Closed dragongears closed 7 years ago
tobytes() is a Python3 function so either use that, which is the best thing to do, or find the future statements to add to your 2.7 code.
Nick
YoungInSurrey@gmail.com On 29 Nov 2016 1:57 am, "Art Dahm" notifications@github.com wrote:
I am trying to use the PaPiRus with a Raspberry Pi 2 and get the following error with any demo that writes to the screen. I am relatively certain I followed the setup instructions correctly.
pi@gear ~ $ sudo papirus-write "Test" Writing to Papirus....... Traceback (most recent call last): File "/usr/local/bin/papirus-write", line 73, in main() File "/usr/local/bin/papirus-write", line 33, in main write_text(papirus, args.content, args.fsize) File "/usr/local/bin/papirus-write", line 69, in write_text papirus.display(image) File "/usr/local/lib/python2.7/dist-packages/papirus/epd.py", line 139, in display f.write(image.tobytes()) File "/usr/lib/python2.7/dist-packages/PIL/Image.py", line 512, in getattr raise AttributeError(name) AttributeError: tobytes
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/PiSupply/PaPiRus/issues/62, or mute the thread https://github.com/notifications/unsubscribe-auth/AF54iHtV7mSp29hOSRxVUlZqQ5fgL_XPks5rC4aHgaJpZM4K-erm .
Hello, did you enable SPI?
On 29 November 2016 at 01:57, Art Dahm notifications@github.com wrote:
I am trying to use the PaPiRus with a Raspberry Pi 2 and get the following error with any demo that writes to the screen. I am relatively certain I followed the setup instructions correctly.
pi@gear ~ $ sudo papirus-write "Test" Writing to Papirus....... Traceback (most recent call last): File "/usr/local/bin/papirus-write", line 73, in main() File "/usr/local/bin/papirus-write", line 33, in main write_text(papirus, args.content, args.fsize) File "/usr/local/bin/papirus-write", line 69, in write_text papirus.display(image) File "/usr/local/lib/python2.7/dist-packages/papirus/epd.py", line 139, in display f.write(image.tobytes()) File "/usr/lib/python2.7/dist-packages/PIL/Image.py", line 512, in getattr raise AttributeError(name) AttributeError: tobytes
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/PiSupply/PaPiRus/issues/62, or mute the thread https://github.com/notifications/unsubscribe-auth/APUu16DQ9ARSM6_6cqZaijL4ZGX3E_UVks5rC4aHgaJpZM4K-erm .
-- Francesco Vannini
Website http://garagetech.tips LinkedIn https://uk.linkedin.com/in/garagetechlinkedin Youtube https://www.youtube.com/user/Happylotube Twitter @GarageTechTweet Facebook https://www.facebook.com/GarageTechBook/ https://m.facebook.com/GarageTechBook/ Google+ https://plus.google.com/+FrancescoVannini Blog http:// http://goog_1875614051/blog.happylot.net
@francesco-vannini Yes, I enabled SPI.
@YoungAtHome I tried running the demo under Python3 and ended up getting even more errors.
It looks to me like the papirus-write demo is written in Python 2 but /usr/local/lib/python2.7/dist-packages/papirus/epd.py is Python 3. But I could be wrong since I don't know much about Python (yet).
I haven't written any actual code yet. I got as far as setting up and installing the PaPiRus on a Raspberry Pi 2 running Raspbian and hit this roadblock while trying out the demos to make sure the PaPiRus works correctly.
You could change the code to use tostring() instead of tobytes() or update your OS with sudo apt-get update and then sudo apt-get dist-upgrade to get the latest firmware.
@francesco-vannini Changing the code to use tostring() did the trick! Thank you!
I am trying to use the PaPiRus with a Raspberry Pi 2 and get the following error with any demo that writes to the screen. I am relatively certain I followed the setup instructions correctly.
pi@gear ~ $ sudo papirus-write "Test" Writing to Papirus....... Traceback (most recent call last): File "/usr/local/bin/papirus-write", line 73, in
main()
File "/usr/local/bin/papirus-write", line 33, in main
write_text(papirus, args.content, args.fsize)
File "/usr/local/bin/papirus-write", line 69, in write_text
papirus.display(image)
File "/usr/local/lib/python2.7/dist-packages/papirus/epd.py", line 139, in display
f.write(image.tobytes())
File "/usr/lib/python2.7/dist-packages/PIL/Image.py", line 512, in getattr
raise AttributeError(name)
AttributeError: tobytes