adafruit / Adafruit-Raspberry-Pi-Python-Code

Adafruit library code for Raspberry Pi
1.43k stars 686 forks source link

ImportError : No module named Adafruit_CharLCD #120

Closed pirakleous closed 9 years ago

pirakleous commented 9 years ago

When i create a new program in Desktop and try to import the Adafruit_CharLCD i get this error: ImportError : No module named Adafruit_CharLCD

but when i move the program to the folder Adafruit_CharLCD works fine. How can i make this to work wherever i save it?

tdicola commented 9 years ago

Copy the Adafruit_CharLCD.py file (and any other files inside the same directory as it) to the same directory as your python script. Whenever Python sees an import statement (like "import Adafruit_CharLCD") it goes through a few paths to find the import file and the last option is to look in the directory of the currently running script.