enviroplus-python icon indicating copy to clipboard operation
enviroplus-python copied to clipboard

light.py sample fails to run on new Enviro+

Open pjsgsy opened this issue 3 years ago • 2 comments

Just reiceived a new Enviro+. Most of the sample seem to run, so the module is working, but the light.py sample does not. It produces this error on startup

:~/Pimoroni/enviroplus/examples $ pi@x1:~/Pimoroni/enviroplus/examples $ python3 light.py Traceback (most recent call last): File "/home/pi/Pimoroni/enviroplus/examples/light.py", line 7, in from ltr559 import LTR559 File "", line 1007, in _find_and_load File "", line 986, in _find_and_load_unlocked File "", line 680, in _load_unlocked File "", line 786, in exec_module File "", line 918, in get_code File "", line 587, in _compile_bytecode ValueError: bad marshal data (unknown type code) ValueError: bad marshal data (unknown type code)

i2c seems enabled and the 23, which I belive is the sensor is there

1:~/Pimoroni/enviroplus/examples $ sudo i2cdetect -y 1 0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: -- -- -- 23 -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- -- 49 -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

Further testing shows anything using the light sensor, all-in-one, or weather-and-light provides the same error.

Traceback (most recent call last): File "/home/pi/Pimoroni/enviroplus/examples/all-in-one.py", line 9, in from ltr559 import LTR559 File "", line 1007, in _find_and_load File "", line 986, in _find_and_load_unlocked File "", line 680, in _load_unlocked File "", line 786, in exec_module File "", line 918, in get_code File "", line 587, in _compile_bytecode ValueError: bad marshal data (unknown type code)

Any ideas what I am doing wrong? Pi is up to date (and fresh) install of NOOBS. I used the one-line install for the samples.

Thanks.

pjsgsy avatar Jul 11 '22 15:07 pjsgsy

Weird - what does pip list show - is ltr559 in there?

This is working for me, but it is some time since I installed things...

You can also run python ./check-install.py which should show you if any dependencies are missing.

andypiper avatar Aug 17 '22 14:08 andypiper

The ValueError: bad marshal data (unknown type code) seems to be the crux of the issue?

I've not come across this before, but it suggests corruption in the .pyc files and might suggest a wider system issue.

Try reinstalling the library with sudo python3 -m pip install --upgrade --force-reinstall ltr559

Gadgetoid avatar Aug 23 '22 11:08 Gadgetoid

Closing as old/stale, but let us know if you're still having issues.

helgibbons avatar Apr 25 '24 14:04 helgibbons