the-raspberry-pi-guy / lcd

This repository contains all of the code for interfacing with a 16x2 Character I2C LCD Display. This accompanies my YouTube tutorial here: https://www.youtube.com/watch?v=fR5XhHYzUK0
188 stars 107 forks source link

ModuleNotFoundError: No module named 'i2c_dev' #21

Closed AlcalaRegenera closed 3 years ago

AlcalaRegenera commented 3 years ago

Hello, I used your code last year with Python2, now i wrote a new program in Python3 and i got this error, I have searched in the network but i don't found any result to fix this problem, sorry If i made any mistake writing in this part, i recently entered in github

I followed all your steeps from your youtube video.

Traceback (most recent call last): File "demo_clock.py", line 8, in import drivers File "/home/pi/lcd/drivers/init.py", line 1, in from i2c_dev import Lcd ModuleNotFoundError: No module named 'i2c_dev'

Thanks!

cgomesu commented 3 years ago

Just saw your message as I'm working on a script right now as well. The error is a relative vs, absolute path issue related to py3. In drivers/__init__.py, just change i2c_dev for .i2c_dev and you should be good to go. (I think we can add such a change to the repo as well because it won't affect Python2 execution. I'll send a PR tomorrow if no one is able to do so before then.) Also, remember that you'll need to install python3-smbus if running Python 3. Otherwise, you'll see a message complaining about the missing smbus pkg. The install script only installs smbus for py2.

AlcalaRegenera commented 3 years ago

hello, I followed your steeps, it is working now, i am very happy and i really thanks you :)

good work :)

Solved.

ghost commented 3 years ago

I was having a little trouble with this at first, but It works now. Thanks, good work.