Connection to Python debugger failed: Interrupted function call: accept failed
I can't seem to get my debugger to work on any files that weren't originally written in Pycharm. I have a load of .py files that were originally written in SublimeText stored in C:\Users\myname\Desktop\PythonFiles. When I try to run and debug files that were written with Pycharm it's fine. And I can run the SublimeText files fine. But I cannot debug them. For reference, my pycharm projects get saved here: C:\Users\myname\PycharmProjects\.
Is the separate paths causing the issue? I don't think it is related to my filenames like with other people who've gotten this error; this happens for any of those files I pick.
Error Message:
Connection to Python debugger failed: Interrupted function call: accept failed
Call stack:
C:\Users\myname\PycharmProjects\debugtest\venv\Scripts\python.exe "C:\Program Files\JetBrains\PyCharm Community Edition 2021.2.3\plugins\python-ce\helpers\pydev\pydevd.py" --multiproc --qt-support=auto --client 127.0.0.1 --port 54061 --file "C:/Users/myname/Desktop/PythonFiles/allprimes.py"
Traceback (most recent call last):
File "C:\Program Files\JetBrains\PyCharm Community Edition 2021.2.3\plugins\python-ce\helpers\pydev\pydevd.py", line 2173, in <module>
main()
File "C:\Program Files\JetBrains\PyCharm Community Edition 2021.2.3\plugins\python-ce\helpers\pydev\pydevd.py", line 2040, in main
debugger = PyDB()
File "C:\Program Files\JetBrains\PyCharm Community Edition 2021.2.3\plugins\python-ce\helpers\pydev\pydevd.py", line 413, in __init__
self._cmd_queue = defaultdict(_queue.Queue) # Key is thread id or '*', value is Queue
AttributeError: module 'queue' has no attribute 'Queue'
Process finished with exit code 1
Please sign in to leave a comment.
Hi,
Usually it's caused by name shadowing, e.g. you have a similarly named module in your project.
Please check if you have modules named `queue` in your project and try renaming them.
Andrey Resler
I do have a file called queue that is in the same folder as some of the other files I was trying to debug in Pycharm. So you're saying Pycharm treats any directory folder containing code as a project folder? Is there any way to deal with code in Pycharm outside the context of a project? It would be nice to not have to switch back and forth between SublimeText and Pycharm when I'm prototyping vs actually working on a specific project.
You can control what is considered part of your project from the project structure settings - https://www.jetbrains.com/help/pycharm/project-structure-dialog.html#2f736
If the directory you're running the code from is not part of content roots - it will be considered an external file. Then, try also removing "Add content/source roots to PYTHONPATH" from your run/debug configuration.