I am using JetBrains Pycharm IDE in ubuntu 18.04
when I am hitting run, it is working fine but debugging is failing every time with the following error.
and this is prompt from debug button
Connection to Python debugger failed Socket closed
I tried these, but couldn't make it work :
uninstalling pycharm
editing interpreter location
removing virtual environment
tried changing debugger port
this is my configuration file
please help me with this issue
6 Answers
After a hell lot of searching and experimenting, found the solution for my issue.
My repo consists of a module named code in it. Similarly, python has a same-named module for debugging, which creating a clash and debugger unable to reach that code.
I renamed it, and it's working like charm now. Had similar issue with 'test' as a module name
1I had/have Python Community Edition (2019.1.1, now 2019.3.3) installed on Windows laptop. I named a new file "String". It took some time before I realized it was the name which caused the debugger to fail. The message I received was "connection to python debugger failed interrupted function call accept failed" . The failure was caused solely by the improper naming of the file. I tested again on version 2019.3.3, the name "string" causes the same failure of the debugger to connect and connection is fine when I change the file name to something else.
Got the same issue on Pycharm Professional 2021.1 on Windows, because of a file I named types.py,
renaming it got the debugger to run.
1I think, the issue of problem is due to "Project" relation. I have confused about debugging trouble. At a moment, I could'nt using the Debug tool in PyCharm, I used to it well before. There are some different about the Project characterization between "PyCharmProjects" and "PythonProject". If you used "PyCharmProjects" at first, it is no trouble. Later you may create new project as "PythonProject", you wouldn't using debug tool in PyCharm. This is in my case, I hope someone get help from this hint.
I had to rename a file named "site.py" to something else to get my debugger to work again.
I had to rename a file named "inspect.py" to something else to get my debugger to work again.