Python debugger not working while normal run does

Answered

The python debugger in Pycharm (I've the latest version) is not working for any Python file (so it's not my project or anything). While running the file normally in Pycharm works perfectly.

Also the window saying "Python has stopped working" keeps popping up even though I'm not running anything.

I updated my Java version following some advice on a post but it doesn't help.

Here's the log from idea.log file:

 

2018-08-07 11:40:41,348 [ 257607] ERROR - python.debugger.PyDebugProcess - socket closed 
java.net.SocketException: socket closed
at java.net.TwoStacksPlainSocketImpl.socketAccept(Native Method)
at java.net.AbstractPlainSocketImpl.accept(AbstractPlainSocketImpl.java:409)
at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:199)
at java.net.ServerSocket.implAccept(ServerSocket.java:545)
at java.net.ServerSocket.accept(ServerSocket.java:513)
at com.jetbrains.python.debugger.pydev.transport.ServerModeDebuggerTransport.waitForConnect(ServerModeDebuggerTransport.java:39)
at com.jetbrains.python.debugger.pydev.RemoteDebugger.waitForConnect(RemoteDebugger.java:89)
at com.jetbrains.python.debugger.pydev.MultiProcessDebugger.waitForConnect(MultiProcessDebugger.java:80)
at com.jetbrains.python.debugger.PyDebugProcess$5.run(PyDebugProcess.java:295)
at com.intellij.openapi.progress.impl.CoreProgressManager$TaskRunnable.run(CoreProgressManager.java:736)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$1(CoreProgressManager.java:157)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:580)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:525)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:85)
at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:144)
at com.intellij.openapi.progress.impl.CoreProgressManager$4.run(CoreProgressManager.java:395)
at com.intellij.openapi.application.impl.ApplicationImpl$1.run(ApplicationImpl.java:310)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
2018-08-07 11:40:41,349 [ 257608] ERROR - python.debugger.PyDebugProcess - PyCharm 2018.2 Build #PC-182.3684.100
2018-08-07 11:40:41,349 [ 257608] ERROR - python.debugger.PyDebugProcess - JDK: 1.8.0_152-release
2018-08-07 11:40:41,349 [ 257608] ERROR - python.debugger.PyDebugProcess - VM: OpenJDK 64-Bit Server VM
2018-08-07 11:40:41,349 [ 257608] ERROR - python.debugger.PyDebugProcess - Vendor: JetBrains s.r.o
2018-08-07 11:40:41,349 [ 257608] ERROR - python.debugger.PyDebugProcess - OS: Windows 10
2018-08-07 11:40:41,349 [ 257608] ERROR - python.debugger.PyDebugProcess - Last Action: Debug
2018-08-07 11:40:46,115 [ 262374] INFO - .skeletons.PySkeletonRefresher - Skeleton for PyQt5.QtBluetooth
2018-08-07 11:40:48,807 [ 265066] INFO - .skeletons.PySkeletonRefresher - Skeleton for PyQt5.QtCore
2018-08-07 11:40:50,179 [ 266438] INFO - .skeletons.PySkeletonRefresher - Skeleton for PyQt5.QtDBus
18 comments

Same problem here. No debug either with Python 2.7 or Python 3.6.

I also created a new project with only one file and it didn't work. Normal run (CTRL+SHIFT+F10) works ok.

PyCharm 2018.2.3 (Community Edition)
Build #PC-182.4323.49, built on September 4, 2018
JRE: 1.8.0_152-release-1248-b8 x86
JVM: OpenJDK Server VM by JetBrains s.r.o
Windows 7 6.1

Anaconda 3.6 32bits + Anaconda 2.7 32bits

 

 

------ LOG MESSAGE ------

2018-09-21 10:13:51,872 [ 940906] ERROR - python.debugger.PyDebugProcess - socket closed
java.net.SocketException: socket closed
at java.net.TwoStacksPlainSocketImpl.socketAccept(Native Method)
at java.net.AbstractPlainSocketImpl.accept(AbstractPlainSocketImpl.java:409)
at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:199)
at java.net.ServerSocket.implAccept(ServerSocket.java:545)
at java.net.ServerSocket.accept(ServerSocket.java:513)
at com.jetbrains.python.debugger.pydev.transport.ServerModeDebuggerTransport.waitForConnect(ServerModeDebuggerTransport.java:39)
at com.jetbrains.python.debugger.pydev.RemoteDebugger.waitForConnect(RemoteDebugger.java:89)
at com.jetbrains.python.debugger.pydev.MultiProcessDebugger.waitForConnect(MultiProcessDebugger.java:80)
at com.jetbrains.python.debugger.PyDebugProcess$5.run(PyDebugProcess.java:295)
at com.intellij.openapi.progress.impl.CoreProgressManager$TaskRunnable.run(CoreProgressManager.java:736)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$1(CoreProgressManager.java:157)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:580)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:525)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:85)
at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:144)
at com.intellij.openapi.progress.impl.CoreProgressManager$4.run(CoreProgressManager.java:395)
at com.intellij.openapi.application.impl.ApplicationImpl$1.run(ApplicationImpl.java:314)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
2018-09-21 10:13:51,875 [ 940909] ERROR - python.debugger.PyDebugProcess - PyCharm 2018.2.3 Build #PC-182.4323.49
2018-09-21 10:13:51,876 [ 940910] ERROR - python.debugger.PyDebugProcess - JDK: 1.8.0_152-release
2018-09-21 10:13:51,877 [ 940911] ERROR - python.debugger.PyDebugProcess - VM: OpenJDK Server VM
2018-09-21 10:13:51,877 [ 940911] ERROR - python.debugger.PyDebugProcess - Vendor: JetBrains s.r.o
2018-09-21 10:13:51,877 [ 940911] ERROR - python.debugger.PyDebugProcess - OS: Windows 7
2018-09-21 10:13:51,878 [ 940912] ERROR - python.debugger.PyDebugProcess - Last Action: ChooseDebugConfiguration

 

 

 

0

I have a fresh installation of the Pycharm PyCharm 2018.2.3 and Python 3.7.0. I can run a simple program without any problem:

print("message")

But when I try to debug it, I get and error message (see below). There is no problem with the debug and run if I use Python 2.7.5.

Copy/paste of the error:

 

C:\Users\Name\AppData\Local\Programs\Python\Python37-32\python.exe "C:\Program Files\JetBrains\PyCharm Community Edition 2018.2.3\helpers\pydev\pydevd.py" --multiproc --qt-support=auto --client 127.0.0.1 --port 52311 --file C:/Users/Name/PycharmProjects/2nd/Test.py
Traceback (most recent call last):
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2018.2.3\helpers\pydev\_pydevd_bundle\pydevd_cython_wrapper.py", line 2, in <module>
    from _pydevd_bundle_ext.pydevd_cython import trace_dispatch, PyDBAdditionalThreadInfo, global_cache_skips, global_cache_frame_skips
ModuleNotFoundError: No module named '_pydevd_bundle_ext'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2018.2.3\helpers\pydev\pydevd.py", line 28, in <module>
    from _pydevd_bundle.pydevd_additional_thread_info import PyDBAdditionalThreadInfo
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2018.2.3\helpers\pydev\_pydevd_bundle\pydevd_additional_thread_info.py", line 17, in <module>
    from _pydevd_bundle.pydevd_cython_wrapper import PyDBAdditionalThreadInfo
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2018.2.3\helpers\pydev\_pydevd_bundle\pydevd_cython_wrapper.py", line 32, in <module>
    mod = __import__(check_name)
  File "_pydevd_bundle\pydevd_cython_win32_37_32.pyx", line 139, in init _pydevd_bundle.pydevd_cython_win32_37_32
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2018.2.3\helpers\pydev\_pydevd_bundle\pydevd_breakpoints.py", line 16, in <module>
    from _pydevd_bundle.pydevd_comm import get_global_debugger
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2018.2.3\helpers\pydev\_pydevd_bundle\pydevd_comm.py", line 82, in <module>
    import pydevconsole
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2018.2.3\helpers\pydev\pydevconsole.py", line 23, in <module>
    fix_getpass.fix_getpass()
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2018.2.3\helpers\pydev\_pydev_bundle\fix_getpass.py", line 3, in fix_getpass
    import getpass
  File "C:\Users\Name\AppData\Local\Programs\Python\Python37-32\lib\getpass.py", line 173, in <module>
    import termios
  File "C:\Users\Name\AppData\Local\Programs\Python\Python37-32\termios.py", line 73
    IGNBRK = 0000001
                   ^
SyntaxError: invalid token

Process finished with exit code 1

 

0

Hi Alex 0,

Thank you for contacting PyCharm support.

Could you please clarify how you installed python interpreter on your machine?

Looks like problem related to termios.

Looking forward to your reply.

Kind regards,

Sergey

https://www.jetbrains.com

The Drive to Develop

0

Hi Sergey,

thank you for coming back to me.

The installation was quite straight forward - i.e. 

I've installed the latest Python 3.7.0 from this link:

https://www.python.org/downloads/release/python-370/

Then I've installed the latest PyCharm Community edition from this link:

https://www.jetbrains.com/pycharm/download/#section=windows

I left the settings and directories at offered default. In PyCharm I've created a new project and pointed to the installed "python.exe" interpreter.

I have Windows10 PRO EN (x64).

As mentioned previously a simple programs print("message") runs fine, but I got an error above when I tried to debug it.

In addition I've installed the latest Python 2.7.5 and did not experienced any problem during run and also debug.

0

Thank you for the update.

1) Please uncheck "Run with Python console" in your Run/Debug Configuration and try again.

2) Try as described here https://youtrack.jetbrains.com/issue/PY-28457#focus=streamItem-27-2706036-0-0

Please let me know the result.

Kind regards,

Sergey

https://www.jetbrains.com

The Drive to Develop

0

Hi Alex,

I had the same problem you reported and just found a quick fix.

I had Anaconda 2 and Anaconda 3 installed, so I decided to organize things here doing the following:

- I removed Anaconda 2 folder on Windows Explorer

- created a new virtual env (on Windows Prompt type: conda create -n py37 python=3.7.0)

- on PyCharm, went to File >> Settings (CTRL+ALT+S) >> Project Interpreter >> Show All >> "+" button >> added the new python.exe interpreter from the virtual env

- on PyCharm, upper right corner of the screen, clicked on the drop down menu on the script's file name >> Edit Configuration >>  Python Interpreter (selected the interpreter from the Virtual Env I just created)

 

And it worked.

I hope this helps.

 

0

@ Sergey Karpov

Hi Sergey,

add 1) The "Run with Python console" was already unchecked before (default setting).

add 2) I tried to set PYDEVD_USE_CYTHON=NO and PYDEVD_USE_FRAME_EVAL=NO environment variable in the corresponding run configuration, but it also did not help. Please find the screenshot with and without variable modification below.

0

Hi, honestly this line

File "C:\Users\Name\AppData\Local\Programs\Python\Python37-32\termios.py", line 73

is super confusing, there should simply be no termios module on windows and I have no idea at this point where it comes from. Do you have something like Cygwin installed? Could you please remove or rename

C:\Users\Name\AppData\Local\Programs\Python\Python37-32\termios.py

file? This way import termios in getpass will correctly fail and execution will proceed.

0

@ Pavel Karateev

Renaming termios.py helped. Thanks! I can now also debug the code.

I have just a fresh Python + PyCharm installation. Nothing like Cygwin was installed in addition.

Not sure if this a clean solution, but most importantly it works now. :)

0

I am using Anaconda with PyCharm Community 2018.2.4 (latest version) on a Windows 10 machine. I also experience this problem: normal run works fine, while debugging results in "Process finished with exit code -1073741819 (0xC0000005)" and no ability to debug.

I have done a file search for "termios.py" in both my AppData-folder (and all sub-directories) as well as my Anaconda-folder (and all sub-directories) without finding the named file. So I am still stuck with no debugging which is a pain.

Hope someone can help?

0

Hi Henrik, I think it's a different problem. Could you please add PYDEVD_USE_CYTHON=NO and PYDEVD_USE_FRAME_EVAL=NO environment variables to the run configuration you are using for debugging? Has it helped? Please feel free to create a new ticket in our bug tracker https://youtrack.jetbrains.com/issues/PY

Is it possible for you to share the project or a relevant part of it with us? Please also specify the Python version you are using.

0

Dear Pavel, Thank you for getting back so quickly! Would you prefer that I create a new ticket in the bug-tracking system?

In the meantime, to answer your question about the two mentioned environment variables: it didn't help.

The actual code resides in is a simple "dummy" project I created to test the debugging:

def print_command(name):
print("Hello", name)


if __name__ == '__main__':
n = "Bob"
print_command(n)

with a breakpoint at the second line.

Regarding your final question, currently I am using Python 3.6.

Kind regards,
Henrik
0

>Regarding your final question, currently I am using Python 3.6.

Could you please open Python Console in PyCharm and copy Python version line from it? I wonder which build version is it.

>Would you prefer that I create a new ticket in the bug-tracking system?

YouTrack has better formatting tools and the OPs' problem is different anyway.

0

Hi Pavel,

I have create an "issue" on YouTracker: PY-32051 Debugging not working in PyCharm Community 21018.2.4

I have also pasted my Python Console print-out into this ticket.

Kind regards,

Henrik

0

This issue is over 4 months old and not solved...

 

I rely on a working IDE. I pay for it and it's not usable for me. Since you introduced the DataScience "gimmicks" in the IDE I ran into a whole lot of issues I didn't have before.

Pardon for the rant, but I except that BASIC features such as debugging to work in an IDE. An IDE should support the programmer in working more efficient and not solving problems that would not arise if using another IDE. The quality of PyCharm got worse over the last 3 years and I really consider cancelling my subscription.... The support is really not there either: "please try this and that after several weeks...." - sorry, but if debuggin is not working, i can go back using vim or any other text editor with syntax highlight and autocomplete....

0

Hi Markus,

I am sincerely sorry for all the inconvenience. Does your problem related to https://youtrack.jetbrains.com/issue/PY-32051?

If yes, then as I can see it should be fixed in the latest PyCharm version.

0

This bug still happens in version 2019.1.2 (profession edition)

Any chance this will be fixed anytime soon?

 

0

Hi Gregg,

Could you please provide some code snippet for reproducing and let us know your Python version?

0

Please sign in to leave a comment.