Heim  >  Fragen und Antworten  >  Hauptteil

Wie man mit plötzlichen Ausnahmen in Python umgeht

1. Bei der Verwendung von RF-Automatisierung meldete Python plötzlich den folgenden Fehler. Es wurde vermutet, dass die Datei aufgrund einer Ausnahme im RF-Framework beschädigt war

D:\python27\Scripts>python
Traceback (most recent call last):
  File "D:\python27\lib\site.py", line 62, in <module>
    import os
  File "D:\python27\lib\os.py", line 63, in <module>
    import ntpath as path
  File "D:\python27\lib\ntpath.py", line 15, in <module>
    from genericpath import _unicode
ImportError: cannot import name _unicode

Wenn Ihnen jemand begegnet ist, helfen Sie mir bitte, damit umzugehen!

三叔三叔2686 Tage vor1027

Antworte allen(1)Ich werde antworten

  • 仅有的幸福

    仅有的幸福2017-06-12 09:24:52

    找了半天方法都不行,最后还是删掉重新装了。
    注意这里重新装时:

        1、提前将site-package里面的文件保存
        2、将d:\python27下所有文件删除
        3、重新安装python,如果安装界面提示的是change、repair、remove,选择repair,完成后,再重新安装执行remove,完成后再重新安装,安装界面应该就是正常的安装步骤了
        4、安装wxpython 一般是这个文件名 wxPython2.8-win32-unicode-2.8.12.1-py27.exe
        4、将之前的site-packages里的文件覆盖到对应文件夹下
        5、重新安装robotframework robotframework-ride ,如果提示已安装,使用命令 pip uninstall xx卸载后,重新安装。
        6、最后cmd中 d:python27\scripts\python ride.py
        It's done
        附带文件目录:
        robotframework-ride (1.5.2.1)
        robotframework-sshlibrary (2.1.2)
        wxPython2.8-win32-unicode-2.8.12.1-py27.exe
        python2.7.11
        
        

    Antwort
    0
  • StornierenAntwort