1am9a09e
1am9a09e

Reputation: 41

'NoneType' object has no attribute 'pydev_do_not_trace'

When I set a remote project interpreter on PyCharm and set breakpoint run Debug mode ,then i got this exceptions.

Traceback (most recent call last):
  File "/home/gaoge/.pycharm_helpers/pydev/_pydevd_bundle/pydevd_comm.py", line 1459, in do_it
    result = pydevd_console_integration.console_exec(self.thread_id, self.frame_id, self.expression, dbg)
  File "/home/gaoge/.pycharm_helpers/pydev/_pydevd_bundle/pydevd_console_integration.py", line 172, in console_exec
    need_more = exec_code(CodeFragment(expression), updated_globals, frame.f_locals, dbg)
  File "/home/gaoge/.pycharm_helpers/pydev/_pydevd_bundle/pydevd_console_integration.py", line 86, in exec_code
    code_executor.interpreter.update(globals, locals)
  File "/home/gaoge/.pycharm_helpers/pydev/_pydev_bundle/pydev_ipython_console_011.py", line 331, in update
    self.ipython.history_manager.save_thread.pydev_do_not_trace = True #don't trace ipython history saving thread
AttributeError: 'NoneType' object has no attribute 'pydev_do_not_trace'

Upvotes: 4

Views: 3615

Answers (3)

Mathieu Gauquelin
Mathieu Gauquelin

Reputation: 625

The problem is on the settings of PyCharm, in the "Build, Execution and deployment" section, then click on "Console", and untick the option "Use iPython if available".

For me the solution is that each time I have the problem. I don't know why it is working but it does.

Upvotes: 9

Jeff Baena
Jeff Baena

Reputation: 11

I ran into the same problem, it's a problem of ipython and sql, I solved by using python 3 for the console, as explained in https://youtrack.jetbrains.com/issue/PY-27270.

I think the problem is not of pycharm but ipython that gets stuck when when trying to retriver the SQL history. By removing the dependency on ipython it is possible to use the console. I am still investigating how to solve the problem on ipython itself (also jupyter crashes on my machine).

Maybe a good starting point for that would be the answer of Tim Mitchell in the above link that has changed pydev_ipython_console_011.py, line 348 to:

if hasattr(self.ipython, 'history_manager') and getattr(self.ipython.history_manager, 'save_thread', None) is not None:

to work around it and it seems to work fine.

Upvotes: 1

Antti A
Antti A

Reputation: 692

I think text here refers the existence of ipython:

self.ipython.history_manager.save_thread.pydev_do_not_trace = True #don't trace ipython history saving thread
AttributeError: 'NoneType' object has no attribute 'pydev_do_not_trace'

I had similar error. When I removed ipython and all Jupyter packages from the project settings, the problem vanished.

Packages can be found from Settings / Project: XXXX > Project Interpreter. Removing is selection and pressing "-" button.

Upvotes: 0

Related Questions