DEV Community

Discussion on: Getting started with the Waveshare 2.7" ePaper HAT on Raspberry Pi

Collapse
 
glanzi profile image
Giacomo Lanzi

I always got this error:

Traceback (most recent call last):
  File "/home/<user>/epaper/test.py", line 4, in <module>
    import epd2in7
  File "/home/<user>/epaper/lib/epd2in7.py", line 31, in <module>
    from . import epdconfig
ImportError: attempted relative import with no known parent package
Enter fullscreen mode Exit fullscreen mode

I tried to put files in lib folder, but I got the same result.
What I did wrong? Here is the file code:

 import sys
 sys.path.insert(1,"lib")

 import epd2in7

 from PIL import Image, ImageDraw, ImageFont
 epd=epd2in7.EPD()
 epd.init()
 epd.Clear(0xFF)
Enter fullscreen mode Exit fullscreen mode

Using "./lib" gave me error, and I figured out that in this way is working. At least is finding the files.