Trying to get started using IronPython in Visual Studio. Created a C# winforms app to run a python script. Get the "unexpected token 'from' error". The python script contains a single line of code:
import numpy as np
That's it. I can't make sense of the error. I tried a print statement which was OK, but any import throws the "from" error.
Here is the C# code:
var py = Python.CreateEngine();
String main = <my anaconda3 directory> ;
String dir = String.Empty;
ICollection<String> paths = py.GetSearchPaths();
paths.Add(dir);
dir = main + @"\Lib\site-packages";
paths.Add(dir);
dir = main + @"\Lib";
paths.Add(dir);
py.SetSearchPaths(paths);
py.ExecuteFile("Test.py");
MessageBox.Show("Done");
Anyone know what is going on?