I'm using windows 7 64bit + Visual C#2012 to develop WinForm 32bit application with .Net Framework 4.0. I want to call some python script within my winform application.
After read the document, i'm now able to call the following code within my WinForm application, and the result is correct.
dynamic np = Py.Import("numpy");
dynamic sin = np.sin;
double c = np.cos(5) + sin(5);
I'm using a python script from https://github.com/
mnielsen/neural-networks-and-by git clone to my local machine c:\mypath\neural-networks-and- deep-learning/blob/master/src/ network2.py deep-learning, it works inside python in my system.
I tried the following code, but the np returns NULL.
dynamic np = Py.Import(@"c:\mypath\neural-
I also tried the following code, but pModule also returns NULL
string workingdir = @"c:\mypath\neural-networks-
IntPtr pythonLock = PythonEngine.AcquireLock();
sys.path.append('" + workingdir + "')\n");
PyObject pModule = PythonEngine.ImportModule(
workingdir + "\\network2.py");
How could I invoke such python script, thanks a lot!
Python.NET mailing list - PythonDotNet@python.org