Python Forum
SMBUS 'no such file or directory' - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: SMBUS 'no such file or directory' (/thread-32265.html)



SMBUS 'no such file or directory' - hcccs - Jan-31-2021

Running this little example

import  I2C_LCD_driver 
from time import *
mylcd = I2C_LCD_drive.lcd()
mylcd.lcd_display_string("Hello Python!", 1)
I get this error in I2C_LCD_driver.py taken from https://www.circuitbasics.com/raspberry-pi-i2c-lcd-set-up-and-programming/
Error:
Python 3.7.3 (/usr/bin/python3) >>> %Run lcd_test.py Traceback (most recent call last): File "/home/pi/Documents/lcd_test.py", line 3, in <module> mylcd = I2C_LCD_driver.lcd() File "/home/pi/Code/I2C_LCD_driver.py", line 109, in __init__ self.lcd_device = i2c_device(ADDRESS) File "/home/pi/Code/I2C_LCD_driver.py", line 30, in __init__ self.bus = smbus.SMBus(port) FileNotFoundError: [Errno 2] No such file or directory >>>



RE: SMBUS 'no such file or directory' - Gribouillis - Jan-31-2021

Try to install smbus
Output:
sudo apt-get install python3-smbus
Or perhaps install it from pypi
Output:
python3.7 -m pip install smbus



RE: SMBUS 'no such file or directory' - hcccs - Jan-31-2021

(Jan-31-2021, 04:19 PM)Gribouillis Wrote: Try to install smbus
Output:
sudo apt-get install python3-smbus
Or perhaps install it from pypi
Output:
python3.7 -m pip install smbus

It's already installed.

Solved! I changed the portnumber from 0 to 1
Output:
smbus.SMBUS(1)