IDLE无法启动;文件中出现意外的unicode字符

时间:2013-12-17 17:32:16

标签: python python-2.7 python-idle

我在Windows 7上运行Python 2.7.2。最近我无法直接打开IDLE。当我从命令行运行Python并导入idlelib.idle时,我收到此错误:

>>> import idlelib.idlepython`.exe
Traceback (Most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python27\lib\idlelib\idle.py", line 10, in <module>
    import idlelib.PyShell
  File "C:\Python27\lib\idlelib\PyShell.py", line 26, in <module>
    from idlelib.EditorWindow import EditorWindow, fixwordbreaks
  File "C:\Python27\lib\idlelib\EditorWindow.py", line 68, in <module>
    class EditorWindow(object):
  File "C:\Python27\lib\idlelib\EditorWindow.py", line 69, in EditorWindow
    from idlelib.Percolator import Percolator
  File "C:\Python27\lib\idlelib\Percolator.py", line 1, in <module>
    from idlelib.WidgetRedirector import WidgetRedirector
  File "C:\Python27\lib\idlelib\WidgetRedirector.py", line 109
    root.w↨+
          ^
SyntaxError: invalid syntax

我该如何解决这个问题?

1 个答案:

答案 0 :(得分:0)

  

确保第109行读取

root.wm_protocol("WM_DELETE_WINDOW", root.quit)
     C:\Python27\lib\idlelib\WidgetRedirector.py中的

     

如果没有,请重新安装Python或只是IDLE。

来自jadkik94,在评论中。