1

I have always been able to cythonize code on my Windows 7 (64-bit) machine with Python 2.7. However of late I am getting following error
error: \Intel\iCLS was unexpected at this time.

A search on this topic suggests issues with spaces and other such characters in bat scripts. However this occurs for the very basic hello world example as well which I tried to cythonize as below:

[cmd_prompt] C:\MyScripts\Python\Cython\hello_world>python setup.py build_ext --inplace

Compiling helloworld.py because it changed.
[1/1] Cythonizing helloworld.py
running build_ext
building 'helloworld' extension
error: \Intel\iCLS was unexpected at this time.

Updating to cython 0.24 did not help.

[Update 1]: I found that I can cythonize the code using cython -a helloworld.py. So I am guessing it's the use of distutils to cythonize that has this issue. Also I compared the .c files that was generated by the successful cythonize with the one that failed and found that they only differ in the beginning. The failed version has this at the top

/* BEGIN: Cython Metadata
{
    "distutils": {}
}
END: Cython Metadata */

I would appreciate any insights on how to resolve this issue?

SBK
  • 340
  • 1
  • 3
  • 10
  • This may be an [answer](http://stackoverflow.com/a/8756990/5781248) to a similar issue. – J.J. Hakala Jul 06 '16 at 14:01
  • Thanks. This solved my issue. I removed all quotes in my system environment variable Path. I had put the quotes on some of them as I was not able to get them to work correctly before. – SBK Jul 08 '16 at 16:47

2 Answers2

2

I was able to narrow down the issue to vcvarsall.bat not being able to initialize the system path while trying to setup Visual Studio tools for the cython build. When I started changing the order of folders in my system path, the error started happening on different things like \NVIDIA unexpected at this time and \Microsoft unexpected at this time etc. Thanks to J.J. Hakala's comment, I tried removing all quotes from the PATH variable and it solved the issue.

I think that the PATH variable is being used by Visual Studio scripts within quotes somewhere ("%PATH%") and when it expands this, the user inserted quotes get wrongly matched to the script inserted quotes and cause this error.

There goes 2 days of my life I am never getting back :) Hopefully this will help someone else from repeating the same mistake.

Community
  • 1
  • 1
SBK
  • 340
  • 1
  • 3
  • 10
  • It is possible to mark your own answer as the answer for the question, the question will then not be shown as unanswered. – J.J. Hakala Jul 11 '16 at 17:05
0

J.J. Hakala and SBK's comments definitely put me on the right track, but did not quite sovle the problem. In the windows environment variables I deleted a "%PATH%" entry and I substituted all references to C:\Progam Files with %ProgramFiles% and those for C:\Progam Files(86) with %ProgramFiles(86)%. After closing and restarting CMD.exe, the problem was gone.

marcopolo
  • 123
  • 2
  • 6