Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

python 3.4 AssertionError in pycharm debugger

I have Pycharm 3.1 installed (latest version) which supposedly supports python 3.4, however, this morning it started throwing exceptions whenever I run debugger. Is there anything I can do to fix this AssertionError?

    C:\Python34\python.exe "C:\Program Files (x86)\JetBrains\PyCharm 3.1\helpers\pydev\pydevd.py" --multiproc --client 127.0.0.1 --port xx --file C:/Users/xx/PycharmProjects/drop/my_file.py
Connected to pydev debugger (build 133.881)
pydev debugger: process 8492 is connecting

None
Exception in thread pydevd.CheckAliveThread:
Traceback (most recent call last):
  File "C:\Python34\lib\threading.py", line 921, in _bootstrap_inner
    self.run()
  File "C:\Program Files (x86)\JetBrains\PyCharm 3.1\helpers\pydev\pydevd_comm.py", line 252, in run
    self.OnRun()
  File "C:\Program Files (x86)\JetBrains\PyCharm 3.1\helpers\pydev\pydevd.py", line 187, in OnRun
    self.stop()
  File "C:\Program Files (x86)\JetBrains\PyCharm 3.1\helpers\pydev\pydevd_comm.py", line 262, in stop
    _Thread_stop(self)
  File "C:\Python34\lib\threading.py", line 990, in _stop
    assert not lock.locked()
AssertionError

Traceback (most recent call last):
  File "C:\Program Files (x86)\JetBrains\PyCharm 3.1\helpers\pydev\pydevd.py", line 996, in trace_dispatch
    if not t.isAlive():
  File "C:\Python34\lib\threading.py", line 1120, in is_alive
    self._wait_for_tstate_lock(False)
  File "C:\Python34\lib\threading.py", line 1076, in _wait_for_tstate_lock
    assert self._is_stopped
AssertionError
Traceback (most recent call last):
  File "C:\Program Files (x86)\JetBrains\PyCharm 3.1\helpers\pydev\pydevd.py", line 996, in trace_dispatch
    if not t.isAlive():
  File "C:\Python34\lib\threading.py", line 1120, in is_alive
    self._wait_for_tstate_lock(False)
  File "C:\Python34\lib\threading.py", line 1076, in _wait_for_tstate_lock
    assert self._is_stopped
AssertionError
Traceback (most recent call last):
  File "C:\Program Files (x86)\JetBrains\PyCharm 3.1\helpers\pydev\pydevd.py", line 996, in trace_dispatch
    if not t.isAlive():
  File "C:\Python34\lib\threading.py", line 1120, in is_alive
    self._wait_for_tstate_lock(False)
  File "C:\Python34\lib\threading.py", line 1076, in _wait_for_tstate_lock
    assert self._is_stopped
AssertionError
Traceback (most recent call last):
  File "C:\Program Files (x86)\JetBrains\PyCharm 3.1\helpers\pydev\pydevd.py", line 996, in trace_dispatch
    if not t.isAlive():
  File "C:\Python34\lib\threading.py", line 1120, in is_alive
    self._wait_for_tstate_lock(False)
  File "C:\Python34\lib\threading.py", line 1076, in _wait_for_tstate_lock
    assert self._is_stopped
AssertionError
Traceback (most recent call last):
  File "C:\Program Files (x86)\JetBrains\PyCharm 3.1\helpers\pydev\pydevd.py", line 996, in trace_dispatch
    if not t.isAlive():
  File "C:\Python34\lib\threading.py", line 1120, in is_alive
    self._wait_for_tstate_lock(False)
  File "C:\Python34\lib\threading.py", line 1076, in _wait_for_tstate_lock
    assert self._is_stopped
AssertionError
Traceback (most recent call last):
  File "C:\Program Files (x86)\JetBrains\PyCharm 3.1\helpers\pydev\pydevd.py", line 996, in trace_dispatch
    if not t.isAlive():
  File "C:\Python34\lib\threading.py", line 1120, in is_alive
    self._wait_for_tstate_lock(False)
  File "C:\Python34\lib\threading.py", line 1076, in _wait_for_tstate_lock
    assert self._is_stopped
AssertionError
Traceback (most recent call last):
  File "C:\Program Files (x86)\JetBrains\PyCharm 3.1\helpers\pydev\pydevd.py", line 996, in trace_dispatch
    if not t.isAlive():
  File "C:\Python34\lib\threading.py", line 1120, in is_alive
    self._wait_for_tstate_lock(False)
  File "C:\Python34\lib\threading.py", line 1076, in _wait_for_tstate_lock
    assert self._is_stopped
AssertionError
Traceback (most recent call last):
  File "C:\Program Files (x86)\JetBrains\PyCharm 3.1\helpers\pydev\pydevd.py", line 996, in trace_dispatch
    if not t.isAlive():
  File "C:\Python34\lib\threading.py", line 1120, in is_alive
    self._wait_for_tstate_lock(False)
  File "C:\Python34\lib\threading.py", line 1076, in _wait_for_tstate_lock
    assert self._is_stopped
AssertionError
Traceback (most recent call last):
  File "C:\Program Files (x86)\JetBrains\PyCharm 3.1\helpers\pydev\pydevd.py", line 996, in trace_dispatch
    if not t.isAlive():
  File "C:\Python34\lib\threading.py", line 1120, in is_alive
    self._wait_for_tstate_lock(False)
  File "C:\Python34\lib\threading.py", line 1076, in _wait_for_tstate_lock
    assert self._is_stopped
AssertionError
Traceback (most recent call last):
  File "C:\Program Files (x86)\JetBrains\PyCharm 3.1\helpers\pydev\pydevd.py", line 996, in trace_dispatch
    if not t.isAlive():
  File "C:\Python34\lib\threading.py", line 1120, in is_alive
    self._wait_for_tstate_lock(False)
  File "C:\Python34\lib\threading.py", line 1076, in _wait_for_tstate_lock
    assert self._is_stopped
AssertionError
Traceback (most recent call last):
  File "C:\Program Files (x86)\JetBrains\PyCharm 3.1\helpers\pydev\pydevd.py", line 996, in trace_dispatch
    if not t.isAlive():
  File "C:\Python34\lib\threading.py", line 1120, in is_alive
    self._wait_for_tstate_lock(False)
  File "C:\Python34\lib\threading.py", line 1076, in _wait_for_tstate_lock
    assert self._is_stopped
AssertionError
Traceback (most recent call last):
  File "C:\Program Files (x86)\JetBrains\PyCharm 3.1\helpers\pydev\pydevd.py", line 996, in trace_dispatch
    if not t.isAlive():
  File "C:\Python34\lib\threading.py", line 1120, in is_alive
    self._wait_for_tstate_lock(False)
  File "C:\Python34\lib\threading.py", line 1076, in _wait_for_tstate_lock
    assert self._is_stopped
AssertionError

Process finished with exit code -1

-- Edit --

I ended up deleting the .py file and recreating the code in a new file, after that, debugger works correctly. I am not sure what corrupts these files, but I have noticed it has happened on several different occasions. AssertionError was one of those times. Another time a .py file got corrupted and the interpreter was throwing an exception that I haven't defined a coding style for unicode char support, even though I had

# -*- coding: utf-8 -*-

What surprised me, even after deleting the whole code (including # -- coding: utf-8 --) and basically calling a simple print() func it would still continue throwing the error! Then again I ended up completely deleting the file and starting from scratch. I felt really shocked, I have no idea how this happened.

like image 803
metabuddy Avatar asked Feb 17 '14 12:02

metabuddy


People also ask

How do I enable debugging actions in PyCharm?

Just right-click any line in the editor and select the Debug <filename> command from the context menu. After the program has been suspended, use the debugger to get the information about the state of the program and how it changes during running.


Video Answer


1 Answers

I meet this problem by using PyCharm 3.1.1 and Python 3.4.0 in Windows.

This is a bug(http://youtrack.jetbrains.com/issue/PY-12317), which is marked "Fixed in 3.1.2".

Thus, I download PyCharm 3.1.2RC2(build 133.1143) in JetBrains PyCharm Preview (EAP) page. And, that version solved this problem.

like image 122
Robert Lu Avatar answered Sep 23 '22 05:09

Robert Lu