我喜欢iPythons混合终端命令和Python的方式,但我不喜欢它显示异常的方式.它看起来像这样:
>>> import foo --------------------------------------------------------------------------- ImportError Traceback (most recent call last)in () ----> 1 import foo ImportError: No module named foo
我宁愿看到正常的Python异常打印:
>>> import foo Traceback (most recent call last): File "", line 1, in ImportError: No module named foo
我在配置中搜索了这样的设置但找不到它.我该怎么做?
设置xmode
为plain
:
In [8]: %xmode plain Exception reporting mode: Plain In [9]: import foo Traceback (most recent call last): File "", line 1, in import foo ImportError: No module named 'foo'
或者使用相应的配置文件条目:
c.TerminalInteractiveShell.xmode = 'Plain'