Python Forum
SMBUS 'no such file or directory'
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
SMBUS 'no such file or directory'
#1
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-...ogramming/
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 >>>
buran write Jan-31-2021, 03:04 PM:
Please, use proper tags when post code, traceback, output, etc. This time I have added tags for you.
See BBcode help for more info.

Please, post the entire traceback that you get. We need to see the whole thing. Do not just give us the last line.
Take a time to read What to include in a post
Reply
#2
Try to install smbus
Output:
sudo apt-get install python3-smbus
Or perhaps install it from pypi
Output:
python3.7 -m pip install smbus
Reply
#3
(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)
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Using pyinstaller with .ui GUI files - No such file or directory error diver999 3 3,075 Jun-27-2023, 01:17 PM
Last Post: diver999
  Extract file only (without a directory it is in) from ZIPIP tester_V 1 928 Jan-23-2023, 04:56 AM
Last Post: deanhystad
Thumbs Up Need to compare the Excel file name with a directory text file. veeran1991 1 1,064 Dec-15-2022, 04:32 PM
Last Post: Larz60+
  no such file or directory in SFTP saisankalpj 2 1,492 Nov-25-2022, 11:07 AM
Last Post: DeaD_EyE
Photo Making Zip file of a file and Directory Nasir 2 984 Oct-07-2022, 02:01 PM
Last Post: Nasir
  Failed to execute child process (No such file or directory) uriel 1 1,616 Sep-15-2022, 03:48 PM
Last Post: Gribouillis
  Need Help: FileNotFoundError:[Errno 2] No such file or directory python202209 5 2,523 Sep-12-2022, 04:50 AM
Last Post: python202209
  importing functions from a separate python file in a separate directory Scordomaniac 3 1,329 May-17-2022, 07:49 AM
Last Post: Pedroski55
  How to read python shortcut target profile directory of Chrome Ink file sunny9495 1 1,617 Apr-12-2022, 06:12 PM
Last Post: sunny9495
Question Help to find the largest int number in a file directory SalzmannNicholas 1 1,586 Jan-13-2022, 05:22 PM
Last Post: ndc85430

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020