最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

How to avoid "object has no attribute 'isAlive'" error while debugging in IntelliJ using Pytho

programmeradmin0浏览0评论

I am writing a simple project in python. My version of python is: 3.13.1 . I am using IntelliJ and Python plugin with version: 241.18034.62. I would like to debug my project but when I try to debug I am getting many errors:

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

bigger part of stacktrace:

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\\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 have understood there is some mismatch with versions. I have tried to change the dbugger properties:

But none if these helped. How should I setup my IntelliJ environment to be able to debug? I would like to avoid downgrading python version.

I am writing a simple project in python. My version of python is: 3.13.1 . I am using IntelliJ and Python plugin with version: 241.18034.62. I would like to debug my project but when I try to debug I am getting many errors:

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

bigger part of stacktrace:

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\\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 have understood there is some mismatch with versions. I have tried to change the dbugger properties:

But none if these helped. How should I setup my IntelliJ environment to be able to debug? I would like to avoid downgrading python version.

Share Improve this question edited Mar 6 at 10:07 fascynacja asked Mar 6 at 8:28 fascynacjafascynacja 2,9705 gold badges29 silver badges53 bronze badges 5
  • isAlive is a python2 thing. This suggests either the IDE is identifying your python process as a python2 interpreter (somehow) or some legacy code in your code base is expected to run on python2 only. Where does this error come from? A small popup in IDE? Otherwise is there no stacktrace to look at? – glee8e Commented Mar 6 at 9:17
  • the error comes from the terminal output. I have edited my question and included the stacktrace – fascynacja Commented Mar 6 at 10:07
  • path in error message may suggest that it is mistake in plugin, not in your code. You may send this problem it author(s) of this plugin – furas Commented Mar 6 at 11:32
  • 1 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. But if it was created for Python 2 (which was using isAlive) then it may have more problems. (PL: powodzenia) – furas Commented Mar 6 at 11:35
  • @furas this workaround worked indeed! Program is running and I am able to see it stopping at desired breakpoint, log output is clear from errors. – fascynacja Commented Mar 6 at 12:13
Add a comment  | 

3 Answers 3

Reset to default 2

Path in error message may suggest that it is mistake in plugin, not in your code.
It looks like 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.

Have you tried using 'is_alive' instead of 'isAlive'? The error message hints that the function name could have been changed.

Your IntelliJ settings look fine. If not the name issue, you can try to upgrade it to the latest available version.

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

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论