question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Python 2.7 broken due to threading.main_thread() call in client.py

See original GitHub issue

When I try to run the example client code the following is thrown

Traceback (most recent call last):
  File "client1.py", line 4, in <module>
    sio = socketio.Client()
  File "[path to local lib]/python2.7/site-packages/socketio/client.py", line 88, in __init__
    threading.current_thread() == threading.main_thread():
AttributeError: 'module' object has no attribute 'main_thread'

In client.py on line 88 a call is made to threading.main_thread() which appears to be a Python 3-only call available on the threading module.

https://docs.python.org/2/library/threading.html

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

5reactions
nicholasgibson2commented, May 26, 2020

another workaround is to install an older version of this library, 4.2.1 worked for me.

pip uninstall python-socketio
pip install -Iv python-socketio==4.2.1
1reaction
sidwarkdcommented, May 17, 2020

@zur250 I show a manual workaround in a video I made that might work for you. Here is a timestamped start into the video at the part where I make the change. It’s a small tweak and worked for me. https://youtu.be/ZEsuIQgsORc?t=209

Read more comments on GitHub >

github_iconTop Results From Across the Web

threading — Thread-based parallelism — Python 3.11.1 ...
Source code: Lib/threading.py This module constructs higher-level threading interfaces on top of the ... Handle uncaught exception raised by Thread.run() .
Read more >
Python Threading: The Complete Guide
The run() function stores a return value as an instance variable, that is then accessed and reported by the main thread after the...
Read more >
Threading issue in Python 2.7 - Stack Overflow
Main Thread. If you do not need the execution of tm to happen in another thread, simple call the function in the current...
Read more >
Incompatibility with multiprocessing.pool in Python 2.7.x #147
The fix in the comment patches current_thread() to return the proper threading.Thread object after a call to Eventlet.monkey_patch() , which ...
Read more >
Python Multithreading and Multiprocessing Tutorial - Toptal
Threading is just one of the many ways concurrent programs can be built. In this article, we will take a look at threading...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found