Daveolw1
Posts: 64
Joined: Thu May 16, 2019 10:24 am

Using 7 segment display inside Python code

Wed May 29, 2019 8:39 pm

Using a 8 digit 7 segment Max7219 display module and want to access it fro my python code by pressing buttons to change the display characters. It works when running from terminal SUDO, but from python I get an error,

"from luma.led_matrix.device import max7219
ImportError: No module named 'luma'"

I believe this is something to with root access although spi is in the 99.com file so it should work.
Any ides how to solve?

David

User avatar
MrYsLab
Posts: 435
Joined: Mon Dec 15, 2014 7:14 pm
Location: Noo Joysey, USA

Re: Using 7 segment display inside Python code

Wed May 29, 2019 9:04 pm

It appears you did not install the library properly. You can find detailed install instructions here: https://luma-led-matrix.readthedocs.io/en/latest/

Andyroo

Re: Using 7 segment display inside Python code

Wed May 29, 2019 9:41 pm

Bit baffled by the OP post :oops:

How do you run it from the terminal as sudo - is it a python program?

If not what program are you running to display things on the segments?

Daveolw1
Posts: 64
Joined: Thu May 16, 2019 10:24 am

Re: Using 7 segment display inside Python code

Thu May 30, 2019 6:36 am

Yes I followed those instructions and did the checks to confirm it had everything installed.
Yes it is Python as stated in my post.

ghp
Posts: 1499
Joined: Wed Jun 12, 2013 12:41 pm
Location: Stuttgart Germany
Contact: Website

Re: Using 7 segment display inside Python code

Thu May 30, 2019 6:51 am

Common problem is that the own python program has same name as an import. In your case, is your file named luma.py ? Then rename it and retry.

Daveolw1
Posts: 64
Joined: Thu May 16, 2019 10:24 am

Re: Using 7 segment display inside Python code

Thu May 30, 2019 2:21 pm

No name is "test7seg.py"

User avatar
DougieLawson
Posts: 39219
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Using 7 segment display inside Python code

Thu May 30, 2019 3:38 pm

Did you install with pip (python2) or pip3 (python3)?
Are you running with python (aka python2) or python3?
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

ghp
Posts: 1499
Joined: Wed Jun 12, 2013 12:41 pm
Location: Stuttgart Germany
Contact: Website

Re: Using 7 segment display inside Python code

Thu May 30, 2019 3:39 pm

Is it a python2-python3 problem? When installing with 'pip', the library goes into the python==python2 modules collection. When starting the application code then with python3, the library is not found.

Install with 'pip' and run with 'python'.
Install with 'pip3' and run with 'python3'.

Daveolw1
Posts: 64
Joined: Thu May 16, 2019 10:24 am

Re: Using 7 segment display inside Python code

Thu May 30, 2019 6:27 pm

Thanks for that information, yes I think that is where I have gone wrong. It is Python3 and I used PIP, and Python.
Will have to start all over again. I missed where it said to change Python to Python3 and PIP to PIP3.

Thanks
David

Return to “Python”