Cannot exit thread with device.close()
See original GitHub issueI started with python-xbee/examples/communication/ReceiveDataPollingSample/ReceiveDataPollingSample.py
example by adding
while True:
xbee_message = device.read_data()
if xbee_message is not None:
print("From %s >> %s" % (xbee_message.remote_device.get_64bit_addr(),
xbee_message.data.decode()))
device.close()
break
The code hang after received a message even though I tried to close device and break from while loop. I have to ctrl-c to exit
Then I got below message:
Exception ignored in: <module 'threading' from '/usr/lib/python3.5/threading.py'>
Traceback (most recent call last):
File "/usr/lib/python3.5/threading.py", line 1288, in _shutdown
t.join()
File "/usr/lib/python3.5/threading.py", line 1054, in join
self._wait_for_tstate_lock()
File "/usr/lib/python3.5/threading.py", line 1070, in _wait_for_tstate_lock
elif lock.acquire(block, timeout):
KeyboardInterrupt
Any suggestion on how I can solve this?
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
Cannot exit thread with device.close() · Issue #33 - GitHub
I started with python-xbee/examples/communication/ReceiveDataPollingSample/ReceiveDataPollingSample.py example by adding while True: ...
Read more >Why does sys.exit() not exit when called inside a thread in ...
The docs for sys.exit() state that the call should exit from Python. I can see from the output of this program that "post...
Read more >Killing threads in Java - GeeksforGeeks
A thread is automatically destroyed when the run() method has completed. But it might be required to kill/stop a thread before it has ......
Read more >An Intro to Threading in Python
In this intermediate-level tutorial, you'll learn how to use threading in your Python programs. You'll see how to create threads, how to coordinate...
Read more >Processes and threads overview - Android Developers
To fix this problem, Android offers several ways to access the UI thread from other threads. Here is a list of methods that...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hello all,
As @FRVisser said, this issue has been resolved in master, but a new release has not been generated. This means that PyPI does not have the latest packaged code to upgrade the library trhough pip.
We are working on generating a new version of the library to distribute through pip, and it will be released shortly.
In the meantime, if any of you needs the changes from master, you can update your python distributions manually. To do so:
These steps should do it for you. Again, we are planning to do the official release soon, which would allow you to upgrade your library thrugh pip: pip install --upgrade digi-xbee
Closing this issue since the fix is already included in the latest release: https://github.com/digidotcom/python-xbee/releases.
To update the library through pip, run
pip install digi-xbee --upgrade
.