Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to avoid "object has no attribute 'isAlive'" error while debugging in IntelliJ using Python plugin version 241.18034.62

I am writing a simple Python 3.13.1 project in IntelliJ PyCharm version 241.18034.62. I would like to debug my project. When I try to debug, I am getting many errors:

AttributeError: '_MainThread' object has no attribute 'isAlive'. Did you mean: 'is_alive'?

This is the bigger version of the stack trace:

C:\projects\mat\venv\Scripts\python.exe -X pycache_prefix=C:\Users\mylogin\AppData\Local\JetBrains\IntelliJIdea2024.1\cpython-cache C:/Users/mylogin/AppData/Roaming/JetBrains/IntelliJIdea2024.1/plugins/python/helpers/pydev/pydevd.py --multiprocess --qt-support=pyqt5 --client 127.0.0.1 --port 4095 --file C:\projects\mat\org\aa\aa\mat\delivery_processor.py 
Connected to pydev debugger (build 241.18034.62)
Traceback (most recent call last):
  File "C:\Users\mylogin\AppData\Roaming\JetBrains\IntelliJIdea2024.1\plugins\python\helpers\pydev\_pydevd_bundle\pydevd_pep_669_tracing.py", line 238, in py_start_callback
    if not is_thread_alive(thread):
           ~~~~~~~~~~~~~~~^^^^^^^^
  File "C:\Users\mylogin\AppData\Roaming\JetBrains\IntelliJIdea2024.1\plugins\python\helpers\pydev\_pydev_bundle\pydev_is_thread_alive.py", line 18, in is_thread_alive
    return t.isAlive()
           ^^^^^^^^^
AttributeError: 'WriterThread' object has no attribute 'isAlive'. Did you mean: 'is_alive'?

From what I understand, there are some version mismatches. I have tried to change the debugger properties, but none of these helped:

enter image description here

How should I setup my IntelliJ environment to be able to debug? I would like to avoid downgrading Python.

like image 620
fascynacja Avatar asked Aug 05 '26 19:08

fascynacja


2 Answers

Path in error message may suggest that it is mistake in plugin, not in your code.
It looks like it is code for Python2 which has function isAlive().

At this moment you may try to fix it.

Open

C:\Users\mylogin\AppData\Roaming\JetBrains\IntelliJIdea2024.1\plugins\python\helpers\pydev\_pydev_bundle\pydev_is_thread_alive.py

and change isAlive into is_alive and it may help in this place.

But if it was created for Python 2 then it may have more problems in other places.


You could send this problem it author(s) of this plugin.

like image 196
furas Avatar answered Aug 07 '26 10:08

furas


I updated pycharm to the newest version and the errors were gone

like image 41
Gerbrand Visscher Avatar answered Aug 07 '26 09:08

Gerbrand Visscher