PyCharm 2019.2未在异常上显示回溯 - python

非常简单的最小示例:

if __name__ == '__main__':
    print("Still ok")
    raise Exception("Dummy exception")
    print("End of Program")

我在使用Python 3.6的PyCharm 2019.2调试器中运行它时得到以下输出:

/usr/bin/python3.6 /home/[...]/pycharm-community-2019.2/helpers/pydev/pydevd.py --multiproc --qt-support=auto --client 127.0.0.1 --port 46850 --file /home/[...]/test_traceback.py
pydev debugger: process 18394 is connecting

Connected to pydev debugger (build 192.5728.105)
Still ok

此时,调试器中断了执行流程,但在调试器控制台中未显示Traceback和Exception消息。如果我在PyCharm 2018.1中运行相同的代码,则在命中断点时确实显示了这些权利。

当我按PyCharm 2019.2未在异常上显示回溯 - python时,会得到所需的输出,但是由于该过程结束,因此我无法再在调试上下文中运行代码:

Traceback (most recent call last):
  File "/home/[...]/pycharm-community-2019.2/helpers/pydev/pydevd.py", line 2060, in <module>
    main()
  File "/home/[...]/pycharm-community-2019.2/helpers/pydev/pydevd.py", line 2054, in main
    globals = debugger.run(setup['file'], None, None, is_module)
  File "/home/[...]/pycharm-community-2019.2/helpers/pydev/pydevd.py", line 1405, in run
    return self._exec(is_module, entry_point_fn, module_name, file, globals, locals)
  File "/home/[...]/pycharm-community-2019.2/helpers/pydev/pydevd.py", line 1412, in _exec
    pydev_imports.execfile(file, globals, locals)  # execute the script
  File "/home/[...]/pycharm-community-2019.2/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "/home/[...]/test_traceback.py", line 4, in <module>
    raise Exception("Dummy exception")
Exception: Dummy exception

Process finished with exit code 1

我的断点配置:

PyCharm 2019.2未在异常上显示回溯 - python

python大神给出的解决方案

它适用于PyCharm(社区)2019.1.4:
PyCharm 2019.2未在异常上显示回溯 - python
好像您遇到了(回归)错误:

[JetBrains.YouTrack]: No Traceback in Debugger's Console

[JetBrains.YouTrack]: No stack trace is printed to the console when debugger breaks on exception

这会影响v2019.2.1,并计划在v2019.2.3中修复。
要解决此问题,您必须:

等待v2019.2.3(或具有此修复程序的任何其他版本)发布,然后切换到该版本(可能要(定期)检查[JetBrains.Blog]: Release Announcements)
恢复到不受错误影响的(先前)版本(正如我已经提到的:2019.1.4)

@ EDIT0
已安装(在20190930上)最新补丁(v2019.2.3),并且PyCharm的控制台中存在追溯(因此,该错误已修复)。

如何使PyCharm从函数定义中获取类型提示并在文档字符串中填充类型值? - python

我总是在函数定义中使用类型提示,例如:def foo(a: int, b: str) -> bool: pass 当我使用PyCharm自动文档字符串生成器在我的代码中创建文档字符串时,我得到以下信息:def foo(a: int, b: str) -> bool: """ :param a: :type a: :p…

PyCharm中Django的文档字符串中未解决的引用 - python

我在Django的专案中使用Google Style Python Docstrings like in this Example。当我创建一个类并在文档字符串中使用属性符号时,Pycharm总是说-“未解决的引用”。class Post(models.Model): """ Class for posts. Attribute…

Python sqlite3数据库已锁定 - python

我在Windows上使用Python 3和sqlite3。我正在开发一个使用数据库存储联系人的小型应用程序。我注意到,如果应用程序被强制关闭(通过错误或通过任务管理器结束),则会收到sqlite3错误(sqlite3.OperationalError:数据库已锁定)。我想这是因为在应用程序关闭之前,我没有正确关闭数据库连接。我已经试过了: connectio…

用大写字母拆分字符串,但忽略AAA Python Regex - python

我的正则表达式:vendor = "MyNameIsJoe. I'mWorkerInAAAinc." ven = re.split(r'(?<=[a-z])[A-Z]|[A-Z](?=[a-z])', vendor) 以大写字母分割字符串,例如:'我的名字是乔。 I'mWorkerInAAAinc”变成…

字符串文字中的正斜杠表现异常 - python

为什么S1和S2在撇号位置方面表现不同?S1="1/282/03/10" S2="4/107/03/10" R1="".join({"N\'" ,S1,"\'" }) R2="".join({"N\'…