osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

ImportError: No module named Adafruit_SSD1306


On 04/12/2019 23:15, Python wrote:
> Le 05/12/2019 ? 00:06, RobH a ?crit?:
>> On 04/12/2019 22:33, Wildman wrote:
>>> On Wed, 04 Dec 2019 20:25:33 +0000, RobH wrote:
>>>
>>>> I am trying to do this project on a pi zero:
>>>>
>>>> http://frederickvandenbosch.be/?p=1365
>>>>
>>>> I copied the code to the pi zero Download folder and when I run it I 
>>>> get
>>>> the above error at line 4
>>>> Import Adafruit_SSD1306
>>>>
>>>> I am using python version 2.7.16, if that makes any difference
>>>> I have the same module as the authors' link goes to :
>>>>
>>>> Monochrome 1.3" 128x64 OLED graphic display - STEMMA QT / Qwiic
>>>>
>>>> Have I missed something.
>>>
>>> The error indicates that Adafruit_SSD1306 in not installed.
>>>
>>> https://github.com/adafruit/Adafruit_Python_SSD1306
>>>
>>
>> I have the library in the same Downloads folder, but I don't know how 
>> to actually install it as it doesn't have an .sh file included
> 
> What cannot you understand in the Installing section of README.md?
> 
>  ? sudo python -m pip install --upgrade pip setuptools wheel
>  ? sudo pip install Adafruit-SSD1306
> 
>  ? Or alternatively:
> 
>  ? sudo python -m pip install --upgrade pip setuptools wheel
>  ? git clone https://github.com/adafruit/Adafruit_Python_SSD1306.git
>  ? cd Adafruit_Python_SSD1306
>  ? sudo python setup.py install
> 
> even WORSE, what cannot you undertand at the top of same file?
> 
>  ? This library has been deprecated! We are leaving this up for
>  ? historical and research purposes but archiving the repository.
> 
> 

I was looking at the wrong file previously, and got mixed up, doh!
I have installed the Adafruit_Python_SSD1306 library now.

(There is no mention that I can see about installing other libraries etc 
to get the project to work, by the author)

I had to make some changes in the authors file here:

import time
import Adafruit_SSD1306
import RPi.GPIO as GPIO <<<<here
from PIL import Image   <<<<here
from PIL import ImageFont <<<<here
from PIL import ImageDraw <<<<here
import os

Due to
import ImageFont
ImportError: No module named ImageFont

etc

Now I get these errors:

pi at raspberrypi:~/Downloads $ python Internet.py
Traceback (most recent call last):
   File "Internet.py", line 164, in <module>
     disp.begin()
   File "build/bdist.linux-armv6l/egg/Adafruit_SSD1306/SSD1306.py", line 
148, in begin
   File "build/bdist.linux-armv6l/egg/Adafruit_SSD1306/SSD1306.py", line 
247, in _initialize
   File "build/bdist.linux-armv6l/egg/Adafruit_SSD1306/SSD1306.py", line 
129, in command
   File "build/bdist.linux-armv6l/egg/Adafruit_GPIO/I2C.py", line 116, 
in write8
   File "build/bdist.linux-armv6l/egg/Adafruit_PureIO/smbus.py", line 
268, in write_byte_data
IOError: [Errno 121] Remote I/O error.

Maybe I have created these errors unknowingly by the said changes I made.

Thanks