2

When I import the code from this project: http://frederickvandenbosch.be/?p=1365 and run the code on the Pi, I get this error. I installed the Adafruit_SSD1306 library and it still does it. Any help would be greatly appreciated. The code is on site that I linked to.

If you can't see the photo, the error message says:

ImportError: No module named 'Image'

Running and showing error

5
  • Did you install PIL with sudo apt-get install python-imaging? Does that resolve the issue?
    – Aurora0001
    Nov 13, 2017 at 16:57
  • @Aurora0001 Yes it is installed, also that library doesn't control an OLED display. If you see the code you will understand. Python-imaging is for imaging formats.
    – Leo
    Nov 13, 2017 at 17:19
  • 1
    Unfortunately I can't see the full code (you only included a small snippet of the code showing the imports, and if I remember correctly, Image comes from PIL, and that's the module that isn't found). It might be best to check with the script author on which library they meant by import Image.
    – Aurora0001
    Nov 13, 2017 at 18:02
  • 1
    @Aurora0001 I fixed it by changing "import Image" to "from PIL import Image" and it now works. Thanks for the help with the PIL stuff.
    – Leo
    Nov 13, 2017 at 18:07
  • You should really be posting code and error messages as text, not as screenshots. Dec 9, 2020 at 14:10

2 Answers 2

4

I changed import Image to from PIL import Image and it now works.

1
  • This way doesn't work as well... Python 3.6.
    – Kirby
    Feb 19, 2020 at 3:16
1

I changed import Image to from PIL import Image and tis worked well for me. My context is to make a specific texture for vpython. My system is mac Mojave(10.14) python --version is Python 2.7.9

1
  • 1
    This adds nothing to the existing answers, and in general you should be posting answers which work on a Pi, not on a Mac. Dec 9, 2020 at 14:14

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