dotHAT python can't find modules

Hi,
First post here :)
I just got a DisplayOTron HAT to play with and everything is working fine but I am having trouble running the advanced examples.
demo.py works fine but when I run menu.py it outputs:
Traceback (most recent call last):
File “game.py”, line 11, in
from plugins.debris import Debris
ImportError: No module named plugins.debris

so I nano into menu.py and I found this line:

Include advanced so Python can find the plugins

sys.path.append("…/…/")

I suspect that I am supposed to change what is in the quotation marks but I am not sure what to.

Thanks in advance,
Uridium

Setup:
Pi2
Raspbian Jessie
Fully updated
used command “curl -sS get.pimoroni.com/displayotron | bash” to setup dot HAT

Ahoy!

How are you running the example code? Are you copying it elsewhere or just navigating into the directory where it exists and running something like sudo python main.py?

It might be we’ve restructured something without updating the path accordingly, but it should just work.

Hi,
Yes I just navigated to the folder where the examples exist and ran the example exactly as you have it.
The result is the same - unable to find the plugin.

It’s not because I’m using Jessie and not Wheezy is it…?

Ha ha. I just spotted the mistake ;) I think one of us has borked up the example files. Sorry :D

Try moving sys.path.append("../../") to before all the plugins import lines. So it reads:

sys.path.append("../../")
from plugins.debris import Debris
from plugins.utils import Backlight, Contrast

Yes!
That’s was the problem. Now I have moved the lines it works a charm.

Thanks for the help!!

Now the real fun begins… 🤓

Kind regards,
Mark!

1 Like