Re: [Python.NET] Reloading modules
Denis Akhiyarov <[email protected]> Mon, 17 Apr 2017 02:16:44 +0000
| Newsgroups | gmane.comp.python.dotnet |
|---|---|
| Message-ID | <CALxxJLQN5jR34PQJAcwxpn1oHwa-SWJqqXzcAfTMNsxWu-wDww@mail.gmail.com> |
Hi Evan (Ebam?), This was not possible until recently due to some issues with PythonEngine.Shutdown(). But it should be fixed in latest pythonnet 2.3.0 according to this bug report: https://github.com/pythonnet/pythonnet/issues/245 If it still doesn't work for you, then please report back your environment, such as Python, .NET/Mono, and OS versions and architectures. Cheers, Denis On Sun, Apr 16, 2017, 9:08 PM Evan Davey <evan.davey-vCe1aHGdUGg/[email protected]> wrote: > Hi, > > I am using Python.Net embedded inside an application. The application > allows me to select and run a python file (which then allows me to use > Python to access that application's C# SDK). > > string code; > using (var streamReader = new StreamReader(scriptFile, Encoding.UTF8)) > { > code = streamReader.ReadToEnd(); > } > > using (Py.GIL()) > { > PythonEngine.Exec(code); > } > > This works, except when the code imports a python module I have to quit > and restart the application in order for the import to reflect any code > changes (which is very slow for debugging). > > How can I reload or reset the PythonEngine before running the code? > > Cheers, > Ebam > > > > _________________________________________________ > Python.NET mailing list - [email protected] > https://mail.python.org/mailman/listinfo/pythondotnet > _________________________________________________ Python.NET mailing list - [email protected] https://mail.python.org/mailman/listinfo/pythondotnet