-1

Happy new year. I am working on a personal project which involves a distance sensor and a LCD display. The distance sensor's data should ideally be displayed on the 16x2 LCD display. The codes for the sensor works. However, when I tried to import "lcddriver"(which contains codes for the LCD display) , it shows:

"ImportError: cannot import name lcddriver"

I cloned please click on me to see the codes that I used... this into my raspberry pi terminal and "lcddriver" is in my file. file page The first line in "nano-distance.py": import lcddriver It did not work out and showed me the error

this is how my code looks in "distance.py": https://github.com/jumejume1/pi-LCD-Ultrasonic/blob/master/distance-lcd.py

Why is there an import error?

Thank you very much in advance.

1

I expect the error is given because there is no module named lcddriver.py which is what import lcddriver will be looking for.

Rename lcddriver to lcddriver.py.

  • thank you very much, sir! – Sharyn Cao Jan 1 at 16:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.