|
Re: [Python.NET] RunString does not work: msg#00009python.dotnet
thanks for your reply. I had the necessary imports in place but was still seeing the error.
The following code from Michael Eddington resolved the issue (I think the current problem is because of the dictionary being used)
public static PyObject RunString(string code) { PyObject module = ImportModule("__main__"); PyDict globals = new PyDict(Runtime.PyModule_GetDict(module.Handle )); if (locals == null) { locals = new PyDict(Runtime.PyDict_New()); } Runtime.Incref(globals.Handle); Runtime.Incref (locals.Handle); IntPtr result = Runtime.PyRun_String(code, (IntPtr)257, globals.Handle, locals.Handle); if (result == IntPtr.Zero) { return null; } return new PyObject(result); } rgd
Sesh
On 3/5/07, Brian Lloyd <brian.lloyd@xxxxxxxxxxxxxx> wrote:
-- Seshagiri Rao Cherukuri _________________________________________________ Python.NET mailing list - PythonDotNet-+ZN9ApsXKcEdnm+yROfE0A@xxxxxxxxxxxxxxxx http://mail.python.org/mailman/listinfo/pythondotnet |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: [Python.NET] RunString does not work: 00009, Brian Lloyd |
|---|---|
| Next by Date: | [Python.NET] Problem with DateTimePicker control: 00009, Peter Schwalm |
| Previous by Thread: | Re: [Python.NET] RunString does not worki: 00009, Brian Lloyd |
| Next by Thread: | [Python.NET] unsubscribe: 00009, andy . bu-qa2Vv93yo6IAvxtiuMwx3w |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |