-
Notifications
You must be signed in to change notification settings - Fork 48
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
interupt prpblems #8
Comments
I may have found the solution, I rebooted and ran the program again without sudo. This seemed to make it work! However, it still doesn't exit cleanly on Ctrl-C. |
It's up to you how you handle keyboard interrupts. Maybe this can help? :-) |
Is there a better way to properly close down the thread that watches interrupts? It seems that hiding the keyboard interrupt isn't the best way. |
@HakanL I'm not quite sure what you mean. To deactivate the listener (and close down the associated processes) you call the
http://piface.github.io/pifacedigitalio/example.html#interrupts Or are you referring to the stackoverflow link I posted above? |
It's probably due to my novice experience with Python, but in my application I have a main function that pumps events and I have a try/catch for KeyboardInterrupt with pass in there. Then the code just runs out of scope. But I get the stack trace on the console with KeyboardInterrupt and one of the stacks is from PiFace. I'm sorry I didn't post the trace, I'll try to do that this weekend (not at home with my Pi now). Here's my code: https://github.com/HakanL/animatroller/blob/master/RaspExpander/RaspExpander.py |
Perhaps the KeyboardInterrupt is being sent to all processes* and you're letting it reach the listener. Try deactivating the listener in your exception handler:
If not, the stack trace would be useful. :-) *The interrupt watcher runs in a separate process because Python can't do real threads |
I tried that, didn't seem to help. Here's the stack trace:
|
I've pushed what I think is a fix to the testing branches in pifacecommon v4.0.0 and pifacedigitalio v2.1.1. Would you mind downloading those and testing them using your code, please? |
I'm still getting a call-stack, but it's slightly different now:
Not sure I installed the updated libraries correctly (I'm still green on Python). I did a git clone/checkout of testing, then python3 setup.py build, followed by install, first on command and then digitalio. Is that it? |
You installed it correctly (although, you don't have to run
Python will look in As for your stack trace, it appears that the "Interrupted system call" can be ignored though I don't really like that solution. Does the error happen every time you close? Can you replicate the error without your full program (just a very basic program that you can kill with Ctrl+C). I've pushed a possible fix in the Thanks |
I have a fresh install on my Pi and I cannot get the interupt code working i run
sudo python3 presslights.py
it just sits there and doesn't respond to switch presses. I have tried other example code and I get nothing on any of the interupts that I've tried.
I have no idea what the problem is, eventually i press ctrl-x-c and get
^X^CException KeyboardInterrupt: KeyboardInterrupt() in <module 'threading' from '/usr/lib/python3.2/threading.py'> ignored
Process Process-1:
Traceback (most recent call last):
File "/usr/lib/python3.2/multiprocessing/process.py", line 267, in _bootstrap
self.run()
File "/usr/lib/python3.2/multiprocessing/process.py", line 116, in run
self._target(_self._args, *_self._kwargs)
File "/usr/local/lib/python3.2/dist-packages/pifacecommon/interrupts.py", line 160, in watch_port_events
events = epoll.poll()
KeyboardInterrupt
Please help as I've just bought 5 pi faces for some school projects.
Thanks
Martyn
The text was updated successfully, but these errors were encountered: