0

I am trying to run vba_extract.py in Visual Studio by IronPython. The compilation returns an error:

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

I searched this issue, and added encoding in Line 2 of vba_extract.py:

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

But it still does not work.

Additionally, I tried the following two lines, which returned the same error:

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

So I guess the problem is from the encoding of test.xlsm.

Could anyone help?

SoftTimur
  • 5,630
  • 38
  • 140
  • 292

0 Answers0