Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When running flicklib demo I get NameError: name 'sys' is not defined #43

Open
lbilde opened this issue Aug 14, 2018 · 7 comments
Open

Comments

@lbilde
Copy link

lbilde commented Aug 14, 2018

Hi Flick :)

When I run flick demo on the pi I keep getting the following error:
pi@raspberrypiLars:~/Flick/bin $ flick-demo
Did not receive firmware info
Traceback (most recent call last):
File "/usr/local/bin/flick-demo", line 4, in
import('pkg_resources').run_script('flicklib==0.0.1', 'flick-demo')
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 739, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 1501, in run_script
exec(script_code, namespace, namespace)
File "/usr/local/lib/python3.5/dist-packages/flicklib-0.0.1-py3.5.egg/EGG-INFO/scripts/flick-demo", line 4, in
import('pkg_resources').run_script('flicklib==0.0.1', 'flick-demo')
File "", line 969, in _find_and_load
File "", line 958, in _find_and_load_unlocked
File "", line 664, in _load_unlocked
File "", line 634, in _load_backward_compatible
File "/usr/local/lib/python3.5/dist-packages/flicklib-0.0.1-py3.5.egg/flicklib.py", line 479, in
NameError: name 'sys' is not defined
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/flicklib-0.0.1-py3.5.egg/flicklib.py", line 462, in _exit
File "/usr/local/lib/python3.5/dist-packages/flicklib-0.0.1-py3.5.egg/flicklib.py", line 330, in _stop_poll
AttributeError: 'NoneType' object has no attribute 'stop'

Any help?

Thanks

@ChristopherRush
Copy link
Contributor

@lbilde Looks like its not picking up the board. Do you have anything else connected? Can you detect the board with i2cdetect -y 1 command?

@lbilde
Copy link
Author

lbilde commented Aug 15, 2018

Hmm seems I can't, using i2cdetect -y 1 results in this:

 0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f

00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

@lbilde
Copy link
Author

lbilde commented Aug 15, 2018

Tried to remove and reattach the hat and i2cdetect -y 1 results in this:
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- 42 -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

However I am still getting the same error as above by the way ..

@ryanteck
Copy link
Contributor

Looks like there's two separate issues here.

Line 479 in the library references sys.exit however we import it already as exit. I'll do a fix for this. #44

However it seems to be directly caused by the library not being able to read the firmware information which could indicate an i2c issue or such.

@lbilde
Copy link
Author

lbilde commented Aug 15, 2018

Trying to reinstall my pi, can the flick-demo run with python 3.7?

@lbilde
Copy link
Author

lbilde commented Aug 15, 2018

After reinstall and using python2.7 I am back and running, thx..

@tvoverbeek
Copy link
Collaborator

@lbilde @ryanteck Yes there is an other issue.
If there is an I2C problem then the atexit function (_exit()) is called.
_exit() stops the polling however at this point the worker thread is not defined yet and hence you get the AttributeError: 'NoneType' object has no attribute 'stop' at line 330.
Suppose we have to add a test like if '_worker' in globals() before calling _worker.stop()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants