我正在尝试以下代码。它会产生错误。如果我没有pdb运行它,它工作正常。我对此感到困惑,因为pdb昨天工作正常。我正在运行Anaconda的python 2.7虚拟环境。任何帮助将不胜感激。
代码:
import pdb
def main():
pdb.set_trace()
print "hello world"
if __name__ == '__main__':
main()
结果:
Traceback (most recent call last):
File "test_code.py", line 8, in <module>
main()
File "test_code.py", line 5, in main
print "hello world"
File "test_code.py", line 5, in main
print "hello world"
File "D:\Users\Tom\Anaconda\envs\py2\lib\bdb.py", line 49, in trace_dispatch
return self.dispatch_line(frame)
File "...\Anaconda\envs\py2\lib\bdb.py", line 67, in dispatch_line
self.user_line(frame)
File "...\Anaconda\envs\py2\lib\pdb.py", line 158, in user_line
self.interaction(frame, None)
File "...\Anaconda\envs\py2\lib\pdb.py", line 210, in interaction
self.cmdloop()
File "...\Anaconda\envs\py2\lib\cmd.py", line 112, in cmdloop
import readline
File "...\Anaconda\envs\py2\lib\site-packages\readline.py", line 6, in <module>
from pyreadline.rlmain import Readline
File "...\Anaconda\envs\py2\lib\site-packages\pyreadline\__init__.py", line 11, in <module>
from . import unicode_helper, logger, clipboard, lineeditor, modes, console
File "...\Anaconda\envs\py2\lib\site-packages\pyreadline\console\__init__.py", line 15, in <module>
from .console import *
File "...\Anaconda\envs\py2\lib\site-packages\pyreadline\console\console.py", line 21, in <module>
import pyreadline.unicode_helper as unicode_helper
AttributeError: 'module' object has no attribute 'unicode_helper'