python-twitch-stream
python-twitch-stream copied to clipboard
Threading exceptions in Python 2.7
Hi, I am running the example code (exactly) provided in the README, and I am intermittently (like, once per 5-10 runs) getting this exception, and then the process stops working:
Unhandled exception in thread started by <bound method Thread.__bootstrap of <Thread(Thread-85, stopped daemon 4523905024)>>
Traceback (most recent call last):
File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 774, in __bootstrap
self.__bootstrap_inner()
File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 789, in __bootstrap_inner
del _limbo[self]
KeyError: <Thread(Thread-85, stopped daemon 4523905024)>
Any ideas? Thanks!
I have also been seeing this other error message. This one is quite common (like 1/3 runs):
Exception in thread Thread-656:
Traceback (most recent call last):
File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 801, in __bootstrap_inner
self.run()
File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 754, in run
self.__target(*self.__args, **self.__kwargs)
File "/usr/local/lib/python2.7/site-packages/twitchstream/outputvideo.py", line 396, in _send_video_frame
self.t.start()
File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 730, in start
raise RuntimeError("threads can only be started once")
RuntimeError: threads can only be started once
I'm not sure if they are related, or if I should open a separate Issue for this one. But again, both happen when running the example code from the README, with correct credentials passed in like this:
$ python python-twitch-stream-example-clean.py -u nhdaly -o
cat twitch-oauth.txt-s
cat twitch-streamkey.txt``
The stream works if I happen to get a run without an exception, but doesn't work otherwise.
I'm sorry, but I honestly have no idea on these:
- The first one has no stack trace going through the code of this library
- The second one passes through the library, but at a point where you can trivially see that there is no way the thread could be started a second time.
Also, the library has been tested by a couple of people, you are the only one reporting these errors unfortunately. I don't know how I could debug them from here.
Yeah fair enough, no problem. That said, I'm definitely just running your code and nothing else. But maybe there's a weird library configuration or something. Yeah, hard to say.
Anyway, I just ended up doing the video through ffmpeg on the command line instead. Thanks a lot! :)
Now he is not the only one cause I have the same problem. I've been followed your tutorial, step by step but when I run the script it returns that
Traceback (most recent call last): File "basic_video_out.py", line 27, in <module> audio_enabled=True) as videostream: File "/usr/local/lib/python2.7/dist-packages/twitchstream/outputvideo.py", line 324, in __init__ super(TwitchBufferedOutputStream, self).__init__(*args, **kwargs) TypeError: __init__() got an unexpected keyword argument 'audio_enabled'
@elhaitiano You're right! Apparently, I used audio_enabled in some versions of the tutorial (on my blog and on this github, not in PyPI) where it should be enable_audio. This should be fixed with commit 39e61cdd4f6fb7fee891d7b8abf2b19d8ae584e8
OK, that's good! It works for me now, but I wanna know how can I now stream a video content even if it live or not using python. If you have some idea I'll be happy . . .
I also find that bug. I don't know what is that exception but the script still run
Unhandled exception in thread started by <bound method Thread.__bootstrap of <Thread(Thread-6183, stopped daemon 140079142004480)>> Traceback (most recent call last): File "/usr/lib/python2.7/threading.py", line 783, in __bootstrap self.__bootstrap_inner() File "/usr/lib/python2.7/threading.py", line 798, in __bootstrap_inner del _limbo[self] KeyError: <Thread(Thread-6183, stopped daemon 140079142004480)>
KeyError: <Thread(Thread-6183, stopped daemon 140079142004480)>
this the keyerror
Can you give me the keyerror? Also on what system are you running this code? Which version of python?