xlsm文件的非ASCII字符'\ xb7'

时间:2016-09-21 20:48:42

标签: python unicode python-unicode

我试图通过IronPython在Visual Studio中运行vba_extract.py。编译返回错误:

enter image description here

An unhandled exception of type 'Microsoft.Scripting.SyntaxErrorException' occurred in IronPython.dll

Additional information: Non-ASCII character '\xb7' in file ../../python/vba_extract.py ../../../tests/test.xlsm on line 1, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details

我搜索了这个问题,并在vba_extract.py的第2行添加了编码:

#!python
# -*- coding: utf-8 -*-

但它仍然不起作用。

此外,我尝试了以下两行,它们返回了相同的错误:

engine.ExecuteFile(@"../../python/irrelevant.py ../../../tests/test.xlsm");
engine.ExecuteFile(@"../../tests/test.xlsm");

所以我猜问题来自于test.xlsm的编码。

有人可以帮忙吗?

0 个答案:

没有答案