mayavi导入UnicodeDecodeError

时间:2015-07-16 11:15:22

标签: python import mayavi

当我尝试从mayavi导入mlab并从spyder运行脚本时,我得到了UnicodeDecodeError。

我正在运行Windows 8计算机。当我搜索这个问题时,我发现非ASCII字符不应该在路径或文件名中,但在我的示例文件test.py中不是这种情况,对于这个最小的例子存储在c:\ test \ < / p>

from mayavi import mlab

我在控制台中获得以下输出(如果我使用Python或IPython控制台,则无关紧要):

runfile('C:/test/test.py', wdir=r'C:/test')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python27\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 601, in runfile
    execfile(filename, namespace)
  File "C:\Python27\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 66, in execfile
    exec(compile(scripttext, filename, 'exec'), glob, loc)
  File "C:/test/test.py", line 1, in <module>
    from mayavi import mlab
  File "C:\Python27\lib\site-packages\mayavi\mlab.py", line 27, in <module>
    from mayavi.tools.camera import view, roll, yaw, pitch, move
  File "C:\Python27\lib\site-packages\mayavi\tools\camera.py", line 25, in <module>
    from engine_manager import get_engine
  File "C:\Python27\lib\site-packages\mayavi\tools\engine_manager.py", line 12, in <module>
    from mayavi.preferences.api import preference_manager
  File "C:\Python27\lib\site-packages\mayavi\preferences\api.py", line 4, in <module>
    from preference_manager import preference_manager
  File "C:\Python27\lib\site-packages\mayavi\preferences\preference_manager.py", line 128, in <module>
    preference_manager = PreferenceManager()
  File "C:\Python27\lib\site-packages\mayavi\preferences\preference_manager.py", line 81, in __init__
    self._load_preferences()
  File "C:\Python27\lib\site-packages\mayavi\preferences\preference_manager.py", line 101, in _load_preferences
    app_home = ETSConfig.get_application_home()
  File "C:\Python27\lib\site-packages\traits\etsconfig\etsconfig.py", line 132, in get_application_home
    self._get_application_dirname())
  File "C:\Python27\lib\ntpath.py", line 84, in join
    result_path = result_path + p_path
UnicodeDecodeError: 'ascii' codec can't decode byte 0xf6 in position 9: ordinal not in range(128)

1 个答案:

答案 0 :(得分:0)

UnicodeDecodeError:“ ascii”编解码器无法解码

错误来源:

文件“ .... \ lib \ site-packages \ pyface \ workbench \ workbench.py​​”,第319行,位于_restore_window_layo ut

memento = pickle.load(f)

我对其进行了如下编辑,现在可以正常使用了:)

memento = pickle.load(f,encoding='latin1')