Hi All
I am trying to embedded python with C#
I need to execute commands like this
*print math.sin(90)*
I am writing my code in C# using wrapper classes.
I wrote my code like this
public void TestCommandFileExecution(string code)
{
IntPtr modulePtr = Runtime.PyImport_ImportModule("math");
IntPtr appPtr = Runtime.PyEval_GetBuiltins();
IntPtr srcCompilation = Runtime.Py_CompileString(code, "<stdin>",
Runtime.Py_single_input);
IntPtr execution = ExtendedRuntime.PyEval_EvalCode(srcCompilation,
appPtr, IntPtr.Zero);
Runtime.PyErr_Print();
}
And I am sending a code like this
CommandFileExecution("print 'test!'"); // Working fine
CommandFileExecution("print math.sin(90)"); // Showing a error like this.
*Traceback <most recent call last>:*
* File”<stdin>”, line 1,in <module>*
*NameError: name ‘math’ is not defined*
* *
Please help me
Thank you
Manoj
_________________________________________________
Python.NET mailing list - [email protected]
http://mail.python.org/mailman/listinfo/pythondotnet