From Steve.Luke at moldev.com Wed Oct 3 17:35:38 2018 From: Steve.Luke at moldev.com (Luke, Steve) Date: Wed, 3 Oct 2018 21:35:38 +0000 Subject: [Python.NET] Embedded Python .Net example - running scripts that import external libraries causes a crash Message-ID: I am getting a crash trying to embed Python into my VB program using Python for .NET. The goal of my application is to allow users to run their own python scripts inside a larger application. The crash I am getting happens the second time I run a script that imports certain large libraries (like numpy or scikit-image) but does not affect all libraries (for example PIL). My environment: Windows 10 Pro x64, Python 3.6.5 (in Anaconda), Python for .Net 2.4.0 (installed from git?s master branch). Here is the VB code: Public Function Startup(ByRef param As String) As Integer PythonEngine.Initialize() 'mm.PrintMsg(PythonEngine.BuildInfo) 'mm.PrintMsg(PythonEngine.Compiler) 'mm.PrintMsg(PythonEngine.Platform) 'mm.PrintMsg(PythonEngine.ProgramName) 'mm.PrintMsg(PythonEngine.PythonHome) 'mm.PrintMsg(PythonEngine.PythonPath) Using (Py.GIL()) Dim scriptPath As String = param Dim scriptDir As String = Path.GetDirectoryName(scriptPath) Dim scriptName As String = GetPythonModuleName(scriptPath) Dim scriptParam As String = "" Dim scriptScope As PyScope = Py.CreateScope() Dim scriptText As String = My.Computer.FileSystem.ReadAllText(scriptPath) scriptScope.Exec(scriptText) If scriptScope.Contains(STARTUP_METHOD_NAME) Then scriptScope.Exec(String.Format("{0}(r'{1}')", STARTUP_METHOD_NAME, scriptParam)) End If scriptScope.Dispose() End Using PythonEngine.Shutdown() Return 0 End Function And this is the Python script I am running: import skimage.io def Startup(param): pass def Docommand(param): pass def Shutdown(): pass When I run it the VB code the first time, things work great. When I run the VB code a second time (without first restarting the entire application) I get an access violation exception on the scriptScope.Exec() call: Exception: System.AccessViolationException : Message: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. Source: Python.Runtime StackTrace: at Python.Runtime.Runtime.PyObject_Call(IntPtr pointer, IntPtr args, IntPtr kw) at Python.Runtime.ImportHook.__import__(IntPtr self, IntPtr args, IntPtr kw) at Python.Runtime.Runtime.PyObject_Call(IntPtr pointer, IntPtr args, IntPtr kw) at Python.Runtime.ImportHook.__import__(IntPtr self, IntPtr args, IntPtr kw) at Python.Runtime.Runtime.PyObject_Call(IntPtr pointer, IntPtr args, IntPtr kw) at Python.Runtime.ImportHook.__import__(IntPtr self, IntPtr args, IntPtr kw) at Python.Runtime.Runtime.PyObject_Call(IntPtr pointer, IntPtr args, IntPtr kw) at Python.Runtime.ImportHook.__import__(IntPtr self, IntPtr args, IntPtr kw) at Python.Runtime.Runtime.PyObject_Call(IntPtr pointer, IntPtr args, IntPtr kw) at Python.Runtime.ImportHook.__import__(IntPtr self, IntPtr args, IntPtr kw) at Python.Runtime.Runtime.PyObject_Call(IntPtr pointer, IntPtr args, IntPtr kw) at Python.Runtime.ImportHook.__import__(IntPtr self, IntPtr args, IntPtr kw) at Python.Runtime.Runtime.PyObject_Call(IntPtr pointer, IntPtr args, IntPtr kw) at Python.Runtime.ImportHook.__import__(IntPtr self, IntPtr args, IntPtr kw) at Python.Runtime.Runtime.PyObject_Call(IntPtr pointer, IntPtr args, IntPtr kw) at Python.Runtime.ImportHook.__import__(IntPtr self, IntPtr args, IntPtr kw) at Python.Runtime.Runtime.PyObject_Call(IntPtr pointer, IntPtr args, IntPtr kw) at Python.Runtime.ImportHook.__import__(IntPtr self, IntPtr args, IntPtr kw) at Python.Runtime.Runtime.PyRun_String(String code, IntPtr st, IntPtr globals, IntPtr locals) at Python.Runtime.PyScope.Exec(String code, IntPtr _globals, IntPtr _locals) at MyApp.MyClass.Startup(String& param) in C:\Git\MyPath\MyApp.vb:line 132 Unfortunately the stack trace doesn't show line numbers for anything in the Python.Runtime. Interestingly, if you look at the VB code, I have some lines of commented out code: 'mm.PrintMsg(PythonEngine.BuildInfo) 'mm.PrintMsg(PythonEngine.Compiler) 'mm.PrintMsg(PythonEngine.Platform) 'mm.PrintMsg(PythonEngine.ProgramName) 'mm.PrintMsg(PythonEngine.PythonHome) 'mm.PrintMsg(PythonEngine.PythonPath) Since the app doesn?t have a console, this sends the text to the enclosing app for display. If I uncommon that code, then the first time I run it I get: default, Mar 29 2018, 13:32:41 [MSC v.1900 64 bit (AMD64)] win32 python F:\Anaconda3\python36.zip;F:\Anaconda3\Lib;F:\Anaconda3\DLLs;C:\MX6 And the second time I run it I get: default, Mar 29 2018, 13:32:41 [MSC v.1900 64 bit (AMD64)] win32 pyth??? ??? F:\Anaconda3\python36.zip;F:\Anaconda3\Lib;F:\Anaconda3\DLLs;C:\MX6 And the application doesn?t crash! Instead it just says the skimage module can?t be found. Notice the bolded lines (bold added after the fact). The program name and python home values are being corrupted. Is there something I am doing wrong as far as taking down the PythonEngine such that it could be put back up in an as-new state later on? Steve Please be advised that this email may contain confidential information. If you are not the intended recipient, please notify us by email by replying to the sender and delete this message. The sender disclaims that the content of this email constitutes an offer to enter into, or the acceptance of, any agreement; provided that the foregoing does not invalidate the binding effect of any digital or other electronic reproduction of a manual signature that is included in any attachment. -------------- next part -------------- An HTML attachment was scrubbed... URL: From rharding64 at yahoo.com Wed Oct 3 22:12:14 2018 From: rharding64 at yahoo.com (Ron Harding) Date: Thu, 4 Oct 2018 02:12:14 +0000 (UTC) Subject: [Python.NET] Embedded Python .Net example - running scripts In-Reply-To: References: Message-ID: <1651768403.3910584.1538619134927@mail.yahoo.com> Did you try background or threadpool threads? Redirected process calls and looking for stdin stdout stderr streams allows more control. Sent from Yahoo Mail on Android On Wed, Oct 3, 2018 at 15:47, Luke, Steve wrote: I am getting a crash trying to embed Python into my VB program using Python for .NET.?The goal of my application is to allow users to run their own python scripts inside a larger application.?The crash I am getting happens the second time I run a script that imports certain large libraries (like numpy or scikit-image) but does not affect all libraries (for example PIL). ? My environment: Windows 10 Pro x64, Python 3.6.5 (in Anaconda), Python for .Net 2.4.0 (installed from git?s master branch). ? Here is the VB code: ???PublicFunction Startup(ByRef param AsString)AsInteger ???????PythonEngine.Initialize() ???????'mm.PrintMsg(PythonEngine.BuildInfo) ???????'mm.PrintMsg(PythonEngine.Compiler) ???????'mm.PrintMsg(PythonEngine.Platform) ???????'mm.PrintMsg(PythonEngine.ProgramName) ???????'mm.PrintMsg(PythonEngine.PythonHome) ???????'mm.PrintMsg(PythonEngine.PythonPath) ???????Using (Py.GIL()) ? ???????????Dim scriptPath AsString = param ? ???????????Dim scriptDir AsString = Path.GetDirectoryName(scriptPath) ???????????Dim scriptName AsString = GetPythonModuleName(scriptPath) ???????????Dim scriptParam AsString = "" ? ???????????Dim scriptScope As PyScope = Py.CreateScope() ? ???????????Dim scriptText AsString = My.Computer.FileSystem.ReadAllText(scriptPath) ???????????scriptScope.Exec(scriptText) ? ???????????If scriptScope.Contains(STARTUP_METHOD_NAME) Then ???????????????scriptScope.Exec(String.Format("{0}(r'{1}')", STARTUP_METHOD_NAME, scriptParam)) ???????????EndIf ? ???????????scriptScope.Dispose() ???????EndUsing ???????PythonEngine.Shutdown() ? ???????Return 0 ???EndFunction ? And this is the Python script I am running: import skimage.io ? defStartup(param): ???pass ? defDocommand(param): ???pass ??? defShutdown(): ???pass ? When I run it the VB code the first time, things work great.?When I run the VB code a second time (without first restarting the entire application) I get an access violation exception on the scriptScope.Exec() call: Exception: System.AccessViolationException : Message: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. Source: Python.Runtime StackTrace: ??at Python.Runtime.Runtime.PyObject_Call(IntPtr pointer, IntPtr args, IntPtr kw) ??at Python.Runtime.ImportHook.__import__(IntPtr self, IntPtr args, IntPtr kw) ??at Python.Runtime.Runtime.PyObject_Call(IntPtr pointer, IntPtr args, IntPtr kw) ??at Python.Runtime.ImportHook.__import__(IntPtr self, IntPtr args, IntPtr kw) ??at Python.Runtime.Runtime.PyObject_Call(IntPtr pointer, IntPtr args, IntPtr kw) ??at Python.Runtime.ImportHook.__import__(IntPtr self, IntPtr args, IntPtr kw) ??at Python.Runtime.Runtime.PyObject_Call(IntPtr pointer, IntPtr args, IntPtr kw) ??at Python.Runtime.ImportHook.__import__(IntPtr self, IntPtr args, IntPtr kw) ??at Python.Runtime.Runtime.PyObject_Call(IntPtr pointer, IntPtr args, IntPtr kw) ??at Python.Runtime.ImportHook.__import__(IntPtr self, IntPtr args, IntPtr kw) ??at Python.Runtime.Runtime.PyObject_Call(IntPtr pointer, IntPtr args, IntPtr kw) ??at Python.Runtime.ImportHook.__import__(IntPtr self, IntPtr args, IntPtr kw) ??at Python.Runtime.Runtime.PyObject_Call(IntPtr pointer, IntPtr args, IntPtr kw) ??at Python.Runtime.ImportHook.__import__(IntPtr self, IntPtr args, IntPtr kw) ??at Python.Runtime.Runtime.PyObject_Call(IntPtr pointer, IntPtr args, IntPtr kw) ??at Python.Runtime.ImportHook.__import__(IntPtr self, IntPtr args, IntPtr kw) ??at Python.Runtime.Runtime.PyObject_Call(IntPtr pointer, IntPtr args, IntPtr kw) ??at Python.Runtime.ImportHook.__import__(IntPtr self, IntPtr args, IntPtr kw) ??at Python.Runtime.Runtime.PyRun_String(String code, IntPtr st, IntPtr globals, IntPtr locals) ??at Python.Runtime.PyScope.Exec(String code, IntPtr _globals, IntPtr _locals) ??at MyApp.MyClass.Startup(String& param) in C:\Git\MyPath\MyApp.vb:line 132 ?Unfortunately the stack trace doesn't show line numbers for anything in the Python.Runtime. ? Interestingly, if you look at the VB code, I have some lines of commented out code: ???????'mm.PrintMsg(PythonEngine.BuildInfo) ???????'mm.PrintMsg(PythonEngine.Compiler) ???????'mm.PrintMsg(PythonEngine.Platform) ???????'mm.PrintMsg(PythonEngine.ProgramName) ???????'mm.PrintMsg(PythonEngine.PythonHome) ???????'mm.PrintMsg(PythonEngine.PythonPath) Since the app doesn?t have a console, this sends the text to the enclosing app for display.?If I uncommon that code, then the first time I run it I get: default, Mar 29 2018, 13:32:41 [MSC v.1900 64 bit (AMD64)] win32 python ? F:\Anaconda3\python36.zip;F:\Anaconda3\Lib;F:\Anaconda3\DLLs;C:\MX6 ? And the second time I run it I get: default, Mar 29 2018, 13:32:41 [MSC v.1900 64 bit (AMD64)] win32 pyth??? ??? F:\Anaconda3\python36.zip;F:\Anaconda3\Lib;F:\Anaconda3\DLLs;C:\MX6 ? And the application doesn?t crash!?Instead it just says the skimage module can?t be found.?Notice the bolded lines (bold added after the fact).?The program name and python home values are being corrupted. Is there something I am doing wrong as far as taking down the PythonEngine such that it could be put back up in an as-new state later on? Steve Please be advised that this email may contain confidential information. If you are not the intended recipient, please notify us by email by replying to the sender and delete this message. The sender disclaims that the content of this email constitutes an offer to enter into, or the acceptance of, any agreement; provided that the foregoing does not invalidate the binding effect of any digital or other electronic reproduction of a manual signature that is included in any attachment._________________________________________________ Python.NET mailing list - PythonDotNet at python.org https://mail.python.org/mailman/listinfo/pythondotnet -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: Untitled URL: From Steve.Luke at moldev.com Thu Oct 4 13:31:55 2018 From: Steve.Luke at moldev.com (Luke, Steve) Date: Thu, 4 Oct 2018 17:31:55 +0000 Subject: [Python.NET] PythonDotNet Digest, Vol 170, Issue 2 In-Reply-To: References: Message-ID: Thanks Ron, "Did you try background or threadpool threads?" Threading isn't an issue here, everything here is single threaded and synchronous. "Redirected process calls and looking for stdin stdout stderr streams allows more control." Unfortunately, when I do this, I don't get any further information. On the Python side I can tell it loads up to the import statement before the crash, and redirecting the VB output doesn't work as the application has no Console and so no stdout or stderr (also, the Access Violation is treated special in .Net so doesn't get caught, so have to rely on Debuger to get info as below rather than catching and logging info). I guess it comes down to this, in the code for PythonEngine's Shutdown method: "The Python runtime can no longer be used in the current process after calling the Shutdown method." I thought that meant it couldn't be re-used after being Shutdown, but I thought it could be re-used if I ran Initialize again. I guess that is wrong. I was also worried that leaving it hanging around but not Shutdown() would cause issues / count as a memory leak as other than this the rest of the VB application is removed from memory when the session comes to an end. But if it strictly means can't be run in the same process no matter what, I can not call Shutdown() at the end of the VB session and when I start a session I can check if it the PythonEngine is initialized first, and only Initialize() if it hasn't yet been. Follow up question: If I never Shutdown() and the process that running it comes to an end what will happen with the PythonEngine? In my situation I don't know when the process is going to end. I can tell when I am done for a particular session (and so can clean up any PyScopes for example), and this is the time when I was calling Shutdown(). But there can be multiple sessions run from the same process so end of session is not a good a spot to call Shutdown(). Do I risk leaving the PythonEngine or something else in a bad state if I never call Shutdown() and just let the process end? Steve ________________________________ ---------------------------------------------------------------------- Message: 1 Date: Thu, 4 Oct 2018 02:12:14 +0000 (UTC) From: Ron Harding To: "A list for users and developers of Python for .NET" Subject: Re: [Python.NET] Embedded Python .Net example - running scripts Message-ID: <1651768403.3910584.1538619134927 at mail.yahoo.com> Content-Type: text/plain; charset="utf-8" Did you try background or threadpool threads? Redirected process calls and looking for stdin stdout stderr streams allows more control. Sent from Yahoo Mail on Android On Wed, Oct 3, 2018 at 15:47, Luke, Steve wrote: I am getting a crash trying to embed Python into my VB program using Python for .NET.?The goal of my application is to allow users to run their own python scripts inside a larger application.?The crash I am getting happens the second time I run a script that imports certain large libraries (like numpy or scikit-image) but does not affect all libraries (for example PIL). ? My environment: Windows 10 Pro x64, Python 3.6.5 (in Anaconda), Python for .Net 2.4.0 (installed from git?s master branch). ? Here is the VB code: ???PublicFunction Startup(ByRef param AsString)AsInteger ???????PythonEngine.Initialize() ???????'mm.PrintMsg(PythonEngine.BuildInfo) ???????'mm.PrintMsg(PythonEngine.Compiler) ???????'mm.PrintMsg(PythonEngine.Platform) ???????'mm.PrintMsg(PythonEngine.ProgramName) ???????'mm.PrintMsg(PythonEngine.PythonHome) ???????'mm.PrintMsg(PythonEngine.PythonPath) ???????Using (Py.GIL()) ? ???????????Dim scriptPath AsString = param ? ???????????Dim scriptDir AsString = Path.GetDirectoryName(scriptPath) ???????????Dim scriptName AsString = GetPythonModuleName(scriptPath) ???????????Dim scriptParam AsString = "" ? ???????????Dim scriptScope As PyScope = Py.CreateScope() ? ???????????Dim scriptText AsString = My.Computer.FileSystem.ReadAllText(scriptPath) ???????????scriptScope.Exec(scriptText) ? ???????????If scriptScope.Contains(STARTUP_METHOD_NAME) Then ???????????????scriptScope.Exec(String.Format("{0}(r'{1}')", STARTUP_METHOD_NAME, scriptParam)) ???????????EndIf ? ???????????scriptScope.Dispose() ???????EndUsing ???????PythonEngine.Shutdown() ? ???????Return 0 ???EndFunction ? And this is the Python script I am running: import skimage.io ? defStartup(param): ???pass ? defDocommand(param): ???pass ??? defShutdown(): ???pass ? When I run it the VB code the first time, things work great.?When I run the VB code a second time (without first restarting the entire application) I get an access violation exception on the scriptScope.Exec() call: Exception: System.AccessViolationException : Message: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. Source: Python.Runtime StackTrace: ??at Python.Runtime.Runtime.PyObject_Call(IntPtr pointer, IntPtr args, IntPtr kw) ??at Python.Runtime.ImportHook.__import__(IntPtr self, IntPtr args, IntPtr kw) ??at Python.Runtime.Runtime.PyObject_Call(IntPtr pointer, IntPtr args, IntPtr kw) ??at Python.Runtime.ImportHook.__import__(IntPtr self, IntPtr args, IntPtr kw) ??at Python.Runtime.Runtime.PyObject_Call(IntPtr pointer, IntPtr args, IntPtr kw) ??at Python.Runtime.ImportHook.__import__(IntPtr self, IntPtr args, IntPtr kw) ??at Python.Runtime.Runtime.PyObject_Call(IntPtr pointer, IntPtr args, IntPtr kw) ??at Python.Runtime.ImportHook.__import__(IntPtr self, IntPtr args, IntPtr kw) ??at Python.Runtime.Runtime.PyObject_Call(IntPtr pointer, IntPtr args, IntPtr kw) ??at Python.Runtime.ImportHook.__import__(IntPtr self, IntPtr args, IntPtr kw) ??at Python.Runtime.Runtime.PyObject_Call(IntPtr pointer, IntPtr args, IntPtr kw) ??at Python.Runtime.ImportHook.__import__(IntPtr self, IntPtr args, IntPtr kw) ??at Python.Runtime.Runtime.PyObject_Call(IntPtr pointer, IntPtr args, IntPtr kw) ??at Python.Runtime.ImportHook.__import__(IntPtr self, IntPtr args, IntPtr kw) ??at Python.Runtime.Runtime.PyObject_Call(IntPtr pointer, IntPtr args, IntPtr kw) ??at Python.Runtime.ImportHook.__import__(IntPtr self, IntPtr args, IntPtr kw) ??at Python.Runtime.Runtime.PyObject_Call(IntPtr pointer, IntPtr args, IntPtr kw) ??at Python.Runtime.ImportHook.__import__(IntPtr self, IntPtr args, IntPtr kw) ??at Python.Runtime.Runtime.PyRun_String(String code, IntPtr st, IntPtr globals, IntPtr locals) ??at Python.Runtime.PyScope.Exec(String code, IntPtr _globals, IntPtr _locals) ??at MyApp.MyClass.Startup(String& param) in C:\Git\MyPath\MyApp.vb:line 132 ?Unfortunately the stack trace doesn't show line numbers for anything in the Python.Runtime. ? Interestingly, if you look at the VB code, I have some lines of commented out code: ???????'mm.PrintMsg(PythonEngine.BuildInfo) ???????'mm.PrintMsg(PythonEngine.Compiler) ???????'mm.PrintMsg(PythonEngine.Platform) ???????'mm.PrintMsg(PythonEngine.ProgramName) ???????'mm.PrintMsg(PythonEngine.PythonHome) ???????'mm.PrintMsg(PythonEngine.PythonPath) Since the app doesn?t have a console, this sends the text to the enclosing app for display.?If I uncommon that code, then the first time I run it I get: default, Mar 29 2018, 13:32:41 [MSC v.1900 64 bit (AMD64)] win32 python ? F:\Anaconda3\python36.zip;F:\Anaconda3\Lib;F:\Anaconda3\DLLs;C:\MX6 ? And the second time I run it I get: default, Mar 29 2018, 13:32:41 [MSC v.1900 64 bit (AMD64)] win32 pyth??? ??? F:\Anaconda3\python36.zip;F:\Anaconda3\Lib;F:\Anaconda3\DLLs;C:\MX6 ? And the application doesn?t crash!?Instead it just says the skimage module can?t be found.?Notice the bolded lines (bold added after the fact).?The program name and python home values are being corrupted. Is there something I am doing wrong as far as taking down the PythonEngine such that it could be put back up in an as-new state later on? Steve Please be advised that this email may contain confidential information. If you are not the intended recipient, please notify us by email by replying to the sender and delete this message. The sender disclaims that the content of this email constitutes an offer to enter into, or the acceptance of, any agreement; provided that the foregoing does not invalidate the binding effect of any digital or other electronic reproduction of a manual signature that is included in any attachment._________________________________________________ Python.NET mailing list - PythonDotNet at python.org https://urldefense.proofpoint.com/v2/url?u=https-3A__mail.python.org_mailman_listinfo_pythondotnet&d=DwICAg&c=9mghv0deYPYDGP-W745IEdQLV1kHpn4XJRvR6xMRXtA&r=XBqO7p7APNCVKpdDR1v4BCUJqDo0CwXYsXZCFrPPxqg&m=IBuMQkjHwpGp1pP7cEvq9ZlXMLFp4HtptzWN_0Jl-9w&s=9lviSxlSv0jZM0AEZlYC1llBN_6m6hm-xeEh0BVllyI&e= -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: Untitled URL: ------------------------------ Subject: Digest Footer _______________________________________________ PythonDotNet mailing list PythonDotNet at python.org https://urldefense.proofpoint.com/v2/url?u=https-3A__mail.python.org_mailman_listinfo_pythondotnet&d=DwICAg&c=9mghv0deYPYDGP-W745IEdQLV1kHpn4XJRvR6xMRXtA&r=XBqO7p7APNCVKpdDR1v4BCUJqDo0CwXYsXZCFrPPxqg&m=IBuMQkjHwpGp1pP7cEvq9ZlXMLFp4HtptzWN_0Jl-9w&s=9lviSxlSv0jZM0AEZlYC1llBN_6m6hm-xeEh0BVllyI&e= ------------------------------ End of PythonDotNet Digest, Vol 170, Issue 2 ******************************************** Please be advised that this email may contain confidential information. If you are not the intended recipient, please notify us by email by replying to the sender and delete this message. The sender disclaims that the content of this email constitutes an offer to enter into, or the acceptance of, any agreement; provided that the foregoing does not invalidate the binding effect of any digital or other electronic reproduction of a manual signature that is included in any attachment. -------------- next part -------------- An HTML attachment was scrubbed... URL: From denis.akhiyarov at gmail.com Thu Oct 4 22:50:46 2018 From: denis.akhiyarov at gmail.com (Denis Akhiyarov) Date: Thu, 4 Oct 2018 21:50:46 -0500 Subject: [Python.NET] Embedded Python .Net example - running scripts In-Reply-To: <1651768403.3910584.1538619134927@mail.yahoo.com> References: <1651768403.3910584.1538619134927@mail.yahoo.com> Message-ID: Please search the issue tracker on github for shutdown related issues. This was discussed extensively. There is WIP pull request worked on by 3 people to support this reloading scenario in Unity. On Wed, Oct 3, 2018, 9:50 PM Ron Harding via PythonDotNet < pythondotnet at python.org> wrote: > Did you try background or threadpool threads? Redirected process calls and > looking for stdin stdout stderr streams allows more control. > > Sent from Yahoo Mail on Android > > > On Wed, Oct 3, 2018 at 15:47, Luke, Steve > wrote: > > I am getting a crash trying to embed Python into my VB program using > Python for .NET. The goal of my application is to allow users to run > their own python scripts inside a larger application. The crash I am > getting happens the second time I run a script that imports certain large > libraries (like numpy or scikit-image) but does not affect all libraries > (for example PIL). > > > > My environment: > > Windows 10 Pro x64, Python 3.6.5 (in Anaconda), Python for .Net 2.4.0 > (installed from git?s master branch). > > > > Here is the VB code: > > Public Function Startup(ByRef param As String) As Integer > > PythonEngine.Initialize() > > 'mm.PrintMsg(PythonEngine.BuildInfo) > > 'mm.PrintMsg(PythonEngine.Compiler) > > 'mm.PrintMsg(PythonEngine.Platform) > > 'mm.PrintMsg(PythonEngine.ProgramName) > > 'mm.PrintMsg(PythonEngine.PythonHome) > > 'mm.PrintMsg(PythonEngine.PythonPath) > > Using (Py.GIL()) > > > > Dim scriptPath As String = param > > > > Dim scriptDir As String = Path.GetDirectoryName(scriptPath) > > Dim scriptName As String = GetPythonModuleName(scriptPath) > > Dim scriptParam As String = "" > > > > Dim scriptScope As PyScope = Py.CreateScope() > > > > Dim scriptText As String = > My.Computer.FileSystem.ReadAllText(scriptPath) > > scriptScope.Exec(scriptText) > > > > If scriptScope.Contains(STARTUP_METHOD_NAME) Then > > scriptScope.Exec(String.Format("{0}(r'{1}')", > STARTUP_METHOD_NAME, scriptParam)) > > End If > > > > scriptScope.Dispose() > > End Using > > PythonEngine.Shutdown() > > > > Return 0 > > End Function > > > > And this is the Python script I am running: > > import skimage.io > > > > def Startup(param): > > pass > > > > def Docommand(param): > > pass > > > > def Shutdown(): > > pass > > > > When I run it the VB code the first time, things work great. When I run > the VB code a second time (without first restarting the entire application) > I get an access violation exception on the scriptScope.Exec() call: > > *Exception:* System.AccessViolationException : > > *Message:* Attempted to read or write protected memory. This is often an > indication that other memory is corrupt. > > *Source:* Python.Runtime > > *StackTrace:* > > at Python.Runtime.Runtime.PyObject_Call(IntPtr pointer, IntPtr args, > IntPtr kw) > > at Python.Runtime.ImportHook.__import__(IntPtr self, IntPtr args, > IntPtr kw) > > at Python.Runtime.Runtime.PyObject_Call(IntPtr pointer, IntPtr args, > IntPtr kw) > > at Python.Runtime.ImportHook.__import__(IntPtr self, IntPtr args, > IntPtr kw) > > at Python.Runtime.Runtime.PyObject_Call(IntPtr pointer, IntPtr args, > IntPtr kw) > > at Python.Runtime.ImportHook.__import__(IntPtr self, IntPtr args, > IntPtr kw) > > at Python.Runtime.Runtime.PyObject_Call(IntPtr pointer, IntPtr args, > IntPtr kw) > > at Python.Runtime.ImportHook.__import__(IntPtr self, IntPtr args, > IntPtr kw) > > at Python.Runtime.Runtime.PyObject_Call(IntPtr pointer, IntPtr args, > IntPtr kw) > > at Python.Runtime.ImportHook.__import__(IntPtr self, IntPtr args, > IntPtr kw) > > at Python.Runtime.Runtime.PyObject_Call(IntPtr pointer, IntPtr args, > IntPtr kw) > > at Python.Runtime.ImportHook.__import__(IntPtr self, IntPtr args, > IntPtr kw) > > at Python.Runtime.Runtime.PyObject_Call(IntPtr pointer, IntPtr args, > IntPtr kw) > > at Python.Runtime.ImportHook.__import__(IntPtr self, IntPtr args, > IntPtr kw) > > at Python.Runtime.Runtime.PyObject_Call(IntPtr pointer, IntPtr args, > IntPtr kw) > > at Python.Runtime.ImportHook.__import__(IntPtr self, IntPtr args, > IntPtr kw) > > at Python.Runtime.Runtime.PyObject_Call(IntPtr pointer, IntPtr args, > IntPtr kw) > > at Python.Runtime.ImportHook.__import__(IntPtr self, IntPtr args, > IntPtr kw) > > at Python.Runtime.Runtime.PyRun_String(String code, IntPtr st, IntPtr > globals, IntPtr locals) > > at Python.Runtime.PyScope.Exec(String code, IntPtr _globals, IntPtr > _locals) > > at MyApp.MyClass.Startup(String& param) in C:\Git\MyPath\MyApp.vb:line > 132 > > Unfortunately the stack trace doesn't show line numbers for anything in > the Python.Runtime. > > > > Interestingly, if you look at the VB code, I have some lines of commented > out code: > > 'mm.PrintMsg(PythonEngine.BuildInfo) > > 'mm.PrintMsg(PythonEngine.Compiler) > > 'mm.PrintMsg(PythonEngine.Platform) > > 'mm.PrintMsg(PythonEngine.ProgramName) > > 'mm.PrintMsg(PythonEngine.PythonHome) > > 'mm.PrintMsg(PythonEngine.PythonPath) > > > Since the app doesn?t have a console, this sends the text to the enclosing > app for display. If I uncommon that code, then the first time I run it I > get: > > default, Mar 29 2018, 13:32:41 > > [MSC v.1900 64 bit (AMD64)] > > win32 > > python > > > > F:\Anaconda3\python36.zip;F:\Anaconda3\Lib;F:\Anaconda3\DLLs;C:\MX6 > > > > And the second time I run it I get: > > default, Mar 29 2018, 13:32:41 > > [MSC v.1900 64 bit (AMD64)] > > win32 > > *pyth???* > > *???* > > F:\Anaconda3\python36.zip;F:\Anaconda3\Lib;F:\Anaconda3\DLLs;C:\MX6 > > > > And the application doesn?t crash! Instead it just says the skimage > module can?t be found. Notice the bolded lines (bold added after the > fact). The program name and python home values are being corrupted. > > Is there something I am doing wrong as far as taking down the PythonEngine > such that it could be put back up in an as-new state later on? > > > Steve > > > Please be advised that this email may contain confidential information. If > you are not the intended recipient, please notify us by email by replying > to the sender and delete this message. The sender disclaims that the > content of this email constitutes an offer to enter into, or the acceptance > of, any agreement; provided that the foregoing does not invalidate the > binding effect of any digital or other electronic reproduction of a manual > signature that is included in any attachment. > _________________________________________________ > Python.NET mailing list - PythonDotNet at python.org > https://mail.python.org/mailman/listinfo/pythondotnet > > _________________________________________________ > Python.NET mailing list - PythonDotNet at python.org > https://mail.python.org/mailman/listinfo/pythondotnet > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ploc at fortress.com Wed Oct 10 09:28:38 2018 From: ploc at fortress.com (Phat Loc) Date: Wed, 10 Oct 2018 13:28:38 +0000 Subject: [Python.NET] Pip Install Pythonnet error Message-ID: Hi All, I am trying do a pip install of pythonnet. I get the following build errors. Any suggestions on how to fix it? (base) C:\Users\ploc>pip install pythonnet Collecting pythonnet Using cached https://files.pythonhosted.org/packages/89/3b/a22cd45b591d6cf490e e8b24d52b9db1f30b4b478b64a9b231c53474731e/pythonnet-2.3.0.tar.gz Building wheels for collected packages: pythonnet Running setup.py bdist_wheel for pythonnet ... error Complete output from command c:\users\ploc\appdata\local\continuum\anaconda3\p ython.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\ploc\\AppData\ \Local\\Temp\\pip-install-r86ym617\\pythonnet\\setup.py';f=getattr(tokenize, 'op en', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile( code, __file__, 'exec'))" bdist_wheel -d C:\Users\ploc\AppData\Local\Temp\pip-wh eel-9cgf0yo2 --python-tag cp37: running bdist_wheel running build running build_ext Checking for updates from https://www.nuget.org/api/v2/. Currently running NuGet.exe 3.5.0. Updating NuGet.exe to 4.7.1. Update successful. MSBuild auto-detection: using msbuild version '15.6.82.30579' from 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\bin'. Restoring NuGet package NUnit.3.6.0. Restoring NuGet package UnmanagedExports.1.2.7. Restoring NuGet package NUnit.ConsoleRunner.3.6.0. Adding package 'NUnit.ConsoleRunner.3.6.0' to folder 'C:\Users\ploc\AppData\Lo cal\Temp\pip-install-r86ym617\pythonnet\packages' Adding package 'NUnit.3.6.0' to folder 'C:\Users\ploc\AppData\Local\Temp\pip-i nstall-r86ym617\pythonnet\packages' Adding package 'UnmanagedExports.1.2.7' to folder 'C:\Users\ploc\AppData\Local \Temp\pip-install-r86ym617\pythonnet\packages' Added package 'UnmanagedExports.1.2.7' to folder 'C:\Users\ploc\AppData\Local\ Temp\pip-install-r86ym617\pythonnet\packages' Added package 'NUnit.ConsoleRunner.3.6.0' to folder 'C:\Users\ploc\AppData\Loc al\Temp\pip-install-r86ym617\pythonnet\packages' Added package 'NUnit.3.6.0' to folder 'C:\Users\ploc\AppData\Local\Temp\pip-in stall-r86ym617\pythonnet\packages' NuGet Config files used: C:\Users\ploc\AppData\Roaming\NuGet\NuGet.Config C:\Program Files (x86)\NuGet\Config\Microsoft.VisualStudio.Offline.config Feeds used: C:\Users\ploc\.nuget\packages\ https://www.nuget.org/api/v2/ http://nuget.grapecity.com/nuget C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\ Installed: 3 package(s) to packages.config projects Traceback (most recent call last): File "tools\geninterop\geninterop.py", line 292, in sys.exit(main()) File "tools\geninterop\geninterop.py", line 272, in main python_h = preprocess_python_headers() File "tools\geninterop\geninterop.py", line 192, in preprocess_python_header s for line in _check_output(cmd).splitlines(): File "tools\geninterop\geninterop.py", line 41, in _check_output output = subprocess.check_output(*args, **kwargs) File "c:\users\ploc\appdata\local\continuum\anaconda3\lib\subprocess.py", li ne 376, in check_output **kwargs).stdout File "c:\users\ploc\appdata\local\continuum\anaconda3\lib\subprocess.py", li ne 453, in run with Popen(*popenargs, **kwargs) as process: File "c:\users\ploc\appdata\local\continuum\anaconda3\lib\subprocess.py", li ne 756, in __init__ restore_signals, start_new_session) File "c:\users\ploc\appdata\local\continuum\anaconda3\lib\subprocess.py", li ne 1155, in _execute_child startupinfo) FileNotFoundError: [WinError 2] The system cannot find the file specified Traceback (most recent call last): File "", line 1, in File "C:\Users\ploc\AppData\Local\Temp\pip-install-r86ym617\pythonnet\setup. py", line 405, in zip_safe=False, File "c:\users\ploc\appdata\local\continuum\anaconda3\lib\site-packages\setu ptools\__init__.py", line 140, in setup return distutils.core.setup(**attrs) File "c:\users\ploc\appdata\local\continuum\anaconda3\lib\distutils\core.py" , line 148, in setup dist.run_commands() File "c:\users\ploc\appdata\local\continuum\anaconda3\lib\distutils\dist.py" , line 966, in run_commands self.run_command(cmd) File "c:\users\ploc\appdata\local\continuum\anaconda3\lib\distutils\dist.py" , line 985, in run_command cmd_obj.run() File "c:\users\ploc\appdata\local\continuum\anaconda3\lib\site-packages\whee l\bdist_wheel.py", line 188, in run self.run_command('build') File "c:\users\ploc\appdata\local\continuum\anaconda3\lib\distutils\cmd.py", line 313, in run_command self.distribution.run_command(command) File "c:\users\ploc\appdata\local\continuum\anaconda3\lib\distutils\dist.py" , line 985, in run_command cmd_obj.run() File "c:\users\ploc\appdata\local\continuum\anaconda3\lib\distutils\command\ build.py", line 135, in run self.run_command(cmd_name) File "c:\users\ploc\appdata\local\continuum\anaconda3\lib\distutils\cmd.py", line 313, in run_command self.distribution.run_command(command) File "c:\users\ploc\appdata\local\continuum\anaconda3\lib\distutils\dist.py" , line 985, in run_command cmd_obj.run() File "c:\users\ploc\appdata\local\continuum\anaconda3\lib\distutils\command\ build_ext.py", line 339, in run self.build_extensions() File "c:\users\ploc\appdata\local\continuum\anaconda3\lib\distutils\command\ build_ext.py", line 448, in build_extensions self._build_extensions_serial() File "c:\users\ploc\appdata\local\continuum\anaconda3\lib\distutils\command\ build_ext.py", line 473, in _build_extensions_serial self.build_extension(ext) File "C:\Users\ploc\AppData\Local\Temp\pip-install-r86ym617\pythonnet\setup. py", line 191, in build_extension subprocess.check_call([sys.executable, geninterop, interop_file]) File "c:\users\ploc\appdata\local\continuum\anaconda3\lib\subprocess.py", li ne 328, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['c:\\users\\ploc\\appdata\\local\\con tinuum\\anaconda3\\python.exe', 'tools\\geninterop\\geninterop.py', 'src\\runtim e\\interop37.cs']' returned non-zero exit status 1. ---------------------------------------- Failed building wheel for pythonnet Running setup.py clean for pythonnet Failed to build pythonnet Installing collected packages: pythonnet Running setup.py install for pythonnet ... error Complete output from command c:\users\ploc\appdata\local\continuum\anaconda3 \python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\ploc\\AppDat a\\Local\\Temp\\pip-install-r86ym617\\pythonnet\\setup.py';f=getattr(tokenize, ' open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compil e(code, __file__, 'exec'))" install --record C:\Users\ploc\AppData\Local\Temp\pi p-record-qmhk9uw7\install-record.txt --single-version-externally-managed --compi le: running install running build running build_ext Checking for updates from https://www.nuget.org/api/v2/. Currently running NuGet.exe 4.7.1. NuGet.exe is up to date. MSBuild auto-detection: using msbuild version '15.6.82.30579' from 'C:\Progr am Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\bin'. All packages listed in packages.config are already installed. Traceback (most recent call last): File "tools\geninterop\geninterop.py", line 292, in sys.exit(main()) File "tools\geninterop\geninterop.py", line 272, in main python_h = preprocess_python_headers() File "tools\geninterop\geninterop.py", line 192, in preprocess_python_head ers for line in _check_output(cmd).splitlines(): File "tools\geninterop\geninterop.py", line 41, in _check_output output = subprocess.check_output(*args, **kwargs) File "c:\users\ploc\appdata\local\continuum\anaconda3\lib\subprocess.py", line 376, in check_output **kwargs).stdout File "c:\users\ploc\appdata\local\continuum\anaconda3\lib\subprocess.py", line 453, in run with Popen(*popenargs, **kwargs) as process: File "c:\users\ploc\appdata\local\continuum\anaconda3\lib\subprocess.py", line 756, in __init__ restore_signals, start_new_session) File "c:\users\ploc\appdata\local\continuum\anaconda3\lib\subprocess.py", line 1155, in _execute_child startupinfo) FileNotFoundError: [WinError 2] The system cannot find the file specified Traceback (most recent call last): File "", line 1, in File "C:\Users\ploc\AppData\Local\Temp\pip-install-r86ym617\pythonnet\setu p.py", line 405, in zip_safe=False, File "c:\users\ploc\appdata\local\continuum\anaconda3\lib\site-packages\se tuptools\__init__.py", line 140, in setup return distutils.core.setup(**attrs) File "c:\users\ploc\appdata\local\continuum\anaconda3\lib\distutils\core.p y", line 148, in setup dist.run_commands() File "c:\users\ploc\appdata\local\continuum\anaconda3\lib\distutils\dist.p y", line 966, in run_commands self.run_command(cmd) File "c:\users\ploc\appdata\local\continuum\anaconda3\lib\distutils\dist.p y", line 985, in run_command cmd_obj.run() File "c:\users\ploc\appdata\local\continuum\anaconda3\lib\site-packages\se tuptools\command\install.py", line 61, in run return orig.install.run(self) File "c:\users\ploc\appdata\local\continuum\anaconda3\lib\distutils\comman d\install.py", line 545, in run self.run_command('build') File "c:\users\ploc\appdata\local\continuum\anaconda3\lib\distutils\cmd.py ", line 313, in run_command self.distribution.run_command(command) File "c:\users\ploc\appdata\local\continuum\anaconda3\lib\distutils\dist.p y", line 985, in run_command cmd_obj.run() File "c:\users\ploc\appdata\local\continuum\anaconda3\lib\distutils\comman d\build.py", line 135, in run self.run_command(cmd_name) File "c:\users\ploc\appdata\local\continuum\anaconda3\lib\distutils\cmd.py ", line 313, in run_command self.distribution.run_command(command) File "c:\users\ploc\appdata\local\continuum\anaconda3\lib\distutils\dist.p y", line 985, in run_command cmd_obj.run() File "c:\users\ploc\appdata\local\continuum\anaconda3\lib\distutils\comman d\build_ext.py", line 339, in run self.build_extensions() File "c:\users\ploc\appdata\local\continuum\anaconda3\lib\distutils\comman d\build_ext.py", line 448, in build_extensions self._build_extensions_serial() File "c:\users\ploc\appdata\local\continuum\anaconda3\lib\distutils\comman d\build_ext.py", line 473, in _build_extensions_serial self.build_extension(ext) File "C:\Users\ploc\AppData\Local\Temp\pip-install-r86ym617\pythonnet\setu p.py", line 191, in build_extension subprocess.check_call([sys.executable, geninterop, interop_file]) File "c:\users\ploc\appdata\local\continuum\anaconda3\lib\subprocess.py", line 328, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['c:\\users\\ploc\\appdata\\local\\c ontinuum\\anaconda3\\python.exe', 'tools\\geninterop\\geninterop.py', 'src\\runt ime\\interop37.cs']' returned non-zero exit status 1. ---------------------------------------- Command "c:\users\ploc\appdata\local\continuum\anaconda3\python.exe -u -c "impor t setuptools, tokenize;__file__='C:\\Users\\ploc\\AppData\\Local\\Temp\\pip-inst all-r86ym617\\pythonnet\\setup.py';f=getattr(tokenize, 'open', open)(__file__);c ode=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec' ))" install --record C:\Users\ploc\AppData\Local\Temp\pip-record-qmhk9uw7\instal l-record.txt --single-version-externally-managed --compile" failed with error co de 1 in C:\Users\ploc\AppData\Local\Temp\pip-install-r86ym617\pythonnet\ Thanks, Phat -------------- next part -------------- An HTML attachment was scrubbed... URL: From ploc at fortress.com Wed Oct 10 09:52:19 2018 From: ploc at fortress.com (Phat Loc) Date: Wed, 10 Oct 2018 13:52:19 +0000 Subject: [Python.NET] Pip Install Pythonnet error Message-ID: Forget the last previous error. I running anaconda and there is a different setup process. Thanks! From: Phat Loc Sent: Wednesday, October 10, 2018 9:29 AM To: 'pythondotnet at python.org' Subject: Pip Install Pythonnet error Hi All, I am trying do a pip install of pythonnet. I get the following build errors. Any suggestions on how to fix it? (base) C:\Users\ploc>pip install pythonnet Collecting pythonnet Using cached https://files.pythonhosted.org/packages/89/3b/a22cd45b591d6cf490e e8b24d52b9db1f30b4b478b64a9b231c53474731e/pythonnet-2.3.0.tar.gz Building wheels for collected packages: pythonnet Running setup.py bdist_wheel for pythonnet ... error Complete output from command c:\users\ploc\appdata\local\continuum\anaconda3\p ython.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\ploc\\AppData\ \Local\\Temp\\pip-install-r86ym617\\pythonnet\\setup.py';f=getattr(tokenize, 'op en', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile( code, __file__, 'exec'))" bdist_wheel -d C:\Users\ploc\AppData\Local\Temp\pip-wh eel-9cgf0yo2 --python-tag cp37: running bdist_wheel running build running build_ext Checking for updates from https://www.nuget.org/api/v2/. Currently running NuGet.exe 3.5.0. Updating NuGet.exe to 4.7.1. Update successful. MSBuild auto-detection: using msbuild version '15.6.82.30579' from 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\bin'. Restoring NuGet package NUnit.3.6.0. Restoring NuGet package UnmanagedExports.1.2.7. Restoring NuGet package NUnit.ConsoleRunner.3.6.0. Adding package 'NUnit.ConsoleRunner.3.6.0' to folder 'C:\Users\ploc\AppData\Lo cal\Temp\pip-install-r86ym617\pythonnet\packages' Adding package 'NUnit.3.6.0' to folder 'C:\Users\ploc\AppData\Local\Temp\pip-i nstall-r86ym617\pythonnet\packages' Adding package 'UnmanagedExports.1.2.7' to folder 'C:\Users\ploc\AppData\Local \Temp\pip-install-r86ym617\pythonnet\packages' Added package 'UnmanagedExports.1.2.7' to folder 'C:\Users\ploc\AppData\Local\ Temp\pip-install-r86ym617\pythonnet\packages' Added package 'NUnit.ConsoleRunner.3.6.0' to folder 'C:\Users\ploc\AppData\Loc al\Temp\pip-install-r86ym617\pythonnet\packages' Added package 'NUnit.3.6.0' to folder 'C:\Users\ploc\AppData\Local\Temp\pip-in stall-r86ym617\pythonnet\packages' NuGet Config files used: C:\Users\ploc\AppData\Roaming\NuGet\NuGet.Config C:\Program Files (x86)\NuGet\Config\Microsoft.VisualStudio.Offline.config Feeds used: C:\Users\ploc\.nuget\packages\ https://www.nuget.org/api/v2/ http://nuget.grapecity.com/nuget C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\ Installed: 3 package(s) to packages.config projects Traceback (most recent call last): File "tools\geninterop\geninterop.py", line 292, in sys.exit(main()) File "tools\geninterop\geninterop.py", line 272, in main python_h = preprocess_python_headers() File "tools\geninterop\geninterop.py", line 192, in preprocess_python_header s for line in _check_output(cmd).splitlines(): File "tools\geninterop\geninterop.py", line 41, in _check_output output = subprocess.check_output(*args, **kwargs) File "c:\users\ploc\appdata\local\continuum\anaconda3\lib\subprocess.py", li ne 376, in check_output **kwargs).stdout File "c:\users\ploc\appdata\local\continuum\anaconda3\lib\subprocess.py", li ne 453, in run with Popen(*popenargs, **kwargs) as process: File "c:\users\ploc\appdata\local\continuum\anaconda3\lib\subprocess.py", li ne 756, in __init__ restore_signals, start_new_session) File "c:\users\ploc\appdata\local\continuum\anaconda3\lib\subprocess.py", li ne 1155, in _execute_child startupinfo) FileNotFoundError: [WinError 2] The system cannot find the file specified Traceback (most recent call last): File "", line 1, in File "C:\Users\ploc\AppData\Local\Temp\pip-install-r86ym617\pythonnet\setup. py", line 405, in zip_safe=False, File "c:\users\ploc\appdata\local\continuum\anaconda3\lib\site-packages\setu ptools\__init__.py", line 140, in setup return distutils.core.setup(**attrs) File "c:\users\ploc\appdata\local\continuum\anaconda3\lib\distutils\core.py" , line 148, in setup dist.run_commands() File "c:\users\ploc\appdata\local\continuum\anaconda3\lib\distutils\dist.py" , line 966, in run_commands self.run_command(cmd) File "c:\users\ploc\appdata\local\continuum\anaconda3\lib\distutils\dist.py" , line 985, in run_command cmd_obj.run() File "c:\users\ploc\appdata\local\continuum\anaconda3\lib\site-packages\whee l\bdist_wheel.py", line 188, in run self.run_command('build') File "c:\users\ploc\appdata\local\continuum\anaconda3\lib\distutils\cmd.py", line 313, in run_command self.distribution.run_command(command) File "c:\users\ploc\appdata\local\continuum\anaconda3\lib\distutils\dist.py" , line 985, in run_command cmd_obj.run() File "c:\users\ploc\appdata\local\continuum\anaconda3\lib\distutils\command\ build.py", line 135, in run self.run_command(cmd_name) File "c:\users\ploc\appdata\local\continuum\anaconda3\lib\distutils\cmd.py", line 313, in run_command self.distribution.run_command(command) File "c:\users\ploc\appdata\local\continuum\anaconda3\lib\distutils\dist.py" , line 985, in run_command cmd_obj.run() File "c:\users\ploc\appdata\local\continuum\anaconda3\lib\distutils\command\ build_ext.py", line 339, in run self.build_extensions() File "c:\users\ploc\appdata\local\continuum\anaconda3\lib\distutils\command\ build_ext.py", line 448, in build_extensions self._build_extensions_serial() File "c:\users\ploc\appdata\local\continuum\anaconda3\lib\distutils\command\ build_ext.py", line 473, in _build_extensions_serial self.build_extension(ext) File "C:\Users\ploc\AppData\Local\Temp\pip-install-r86ym617\pythonnet\setup. py", line 191, in build_extension subprocess.check_call([sys.executable, geninterop, interop_file]) File "c:\users\ploc\appdata\local\continuum\anaconda3\lib\subprocess.py", li ne 328, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['c:\\users\\ploc\\appdata\\local\\con tinuum\\anaconda3\\python.exe', 'tools\\geninterop\\geninterop.py', 'src\\runtim e\\interop37.cs']' returned non-zero exit status 1. ---------------------------------------- Failed building wheel for pythonnet Running setup.py clean for pythonnet Failed to build pythonnet Installing collected packages: pythonnet Running setup.py install for pythonnet ... error Complete output from command c:\users\ploc\appdata\local\continuum\anaconda3 \python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\ploc\\AppDat a\\Local\\Temp\\pip-install-r86ym617\\pythonnet\\setup.py';f=getattr(tokenize, ' open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compil e(code, __file__, 'exec'))" install --record C:\Users\ploc\AppData\Local\Temp\pi p-record-qmhk9uw7\install-record.txt --single-version-externally-managed --compi le: running install running build running build_ext Checking for updates from https://www.nuget.org/api/v2/. Currently running NuGet.exe 4.7.1. NuGet.exe is up to date. MSBuild auto-detection: using msbuild version '15.6.82.30579' from 'C:\Progr am Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\bin'. All packages listed in packages.config are already installed. Traceback (most recent call last): File "tools\geninterop\geninterop.py", line 292, in sys.exit(main()) File "tools\geninterop\geninterop.py", line 272, in main python_h = preprocess_python_headers() File "tools\geninterop\geninterop.py", line 192, in preprocess_python_head ers for line in _check_output(cmd).splitlines(): File "tools\geninterop\geninterop.py", line 41, in _check_output output = subprocess.check_output(*args, **kwargs) File "c:\users\ploc\appdata\local\continuum\anaconda3\lib\subprocess.py", line 376, in check_output **kwargs).stdout File "c:\users\ploc\appdata\local\continuum\anaconda3\lib\subprocess.py", line 453, in run with Popen(*popenargs, **kwargs) as process: File "c:\users\ploc\appdata\local\continuum\anaconda3\lib\subprocess.py", line 756, in __init__ restore_signals, start_new_session) File "c:\users\ploc\appdata\local\continuum\anaconda3\lib\subprocess.py", line 1155, in _execute_child startupinfo) FileNotFoundError: [WinError 2] The system cannot find the file specified Traceback (most recent call last): File "", line 1, in File "C:\Users\ploc\AppData\Local\Temp\pip-install-r86ym617\pythonnet\setu p.py", line 405, in zip_safe=False, File "c:\users\ploc\appdata\local\continuum\anaconda3\lib\site-packages\se tuptools\__init__.py", line 140, in setup return distutils.core.setup(**attrs) File "c:\users\ploc\appdata\local\continuum\anaconda3\lib\distutils\core.p y", line 148, in setup dist.run_commands() File "c:\users\ploc\appdata\local\continuum\anaconda3\lib\distutils\dist.p y", line 966, in run_commands self.run_command(cmd) File "c:\users\ploc\appdata\local\continuum\anaconda3\lib\distutils\dist.p y", line 985, in run_command cmd_obj.run() File "c:\users\ploc\appdata\local\continuum\anaconda3\lib\site-packages\se tuptools\command\install.py", line 61, in run return orig.install.run(self) File "c:\users\ploc\appdata\local\continuum\anaconda3\lib\distutils\comman d\install.py", line 545, in run self.run_command('build') File "c:\users\ploc\appdata\local\continuum\anaconda3\lib\distutils\cmd.py ", line 313, in run_command self.distribution.run_command(command) File "c:\users\ploc\appdata\local\continuum\anaconda3\lib\distutils\dist.p y", line 985, in run_command cmd_obj.run() File "c:\users\ploc\appdata\local\continuum\anaconda3\lib\distutils\comman d\build.py", line 135, in run self.run_command(cmd_name) File "c:\users\ploc\appdata\local\continuum\anaconda3\lib\distutils\cmd.py ", line 313, in run_command self.distribution.run_command(command) File "c:\users\ploc\appdata\local\continuum\anaconda3\lib\distutils\dist.p y", line 985, in run_command cmd_obj.run() File "c:\users\ploc\appdata\local\continuum\anaconda3\lib\distutils\comman d\build_ext.py", line 339, in run self.build_extensions() File "c:\users\ploc\appdata\local\continuum\anaconda3\lib\distutils\comman d\build_ext.py", line 448, in build_extensions self._build_extensions_serial() File "c:\users\ploc\appdata\local\continuum\anaconda3\lib\distutils\comman d\build_ext.py", line 473, in _build_extensions_serial self.build_extension(ext) File "C:\Users\ploc\AppData\Local\Temp\pip-install-r86ym617\pythonnet\setu p.py", line 191, in build_extension subprocess.check_call([sys.executable, geninterop, interop_file]) File "c:\users\ploc\appdata\local\continuum\anaconda3\lib\subprocess.py", line 328, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['c:\\users\\ploc\\appdata\\local\\c ontinuum\\anaconda3\\python.exe', 'tools\\geninterop\\geninterop.py', 'src\\runt ime\\interop37.cs']' returned non-zero exit status 1. ---------------------------------------- Command "c:\users\ploc\appdata\local\continuum\anaconda3\python.exe -u -c "impor t setuptools, tokenize;__file__='C:\\Users\\ploc\\AppData\\Local\\Temp\\pip-inst all-r86ym617\\pythonnet\\setup.py';f=getattr(tokenize, 'open', open)(__file__);c ode=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec' ))" install --record C:\Users\ploc\AppData\Local\Temp\pip-record-qmhk9uw7\instal l-record.txt --single-version-externally-managed --compile" failed with error co de 1 in C:\Users\ploc\AppData\Local\Temp\pip-install-r86ym617\pythonnet\ Thanks, Phat -------------- next part -------------- An HTML attachment was scrubbed... URL: From surya.pradhan123 at gmail.com Wed Oct 10 13:31:56 2018 From: surya.pradhan123 at gmail.com (Surya Kant Pradhan) Date: Wed, 10 Oct 2018 13:31:56 -0400 Subject: [Python.NET] PythonNet support for Python 3.7 Message-ID: Hi Dev Community, I was following the list of issues under: https://github.com/pythonnet/pythonnet/issues/609, but not getting an idea on when possibly is the release timeline for officially supporting Python 3.7. If you can share some rough estimates on a possible release date, it would really help us decide our own migration plans. Thanks, Surya. -------------- next part -------------- An HTML attachment was scrubbed... URL: From denis.akhiyarov at gmail.com Fri Oct 12 01:22:10 2018 From: denis.akhiyarov at gmail.com (Denis Akhiyarov) Date: Fri, 12 Oct 2018 00:22:10 -0500 Subject: [Python.NET] PythonNet support for Python 3.7 In-Reply-To: References: Message-ID: Would you like to contribute Python 3.7 support? On Fri, Oct 12, 2018, 12:17 AM Surya Kant Pradhan < surya.pradhan123 at gmail.com> wrote: > Hi Dev Community, > > I was following the list of issues under: > https://github.com/pythonnet/pythonnet/issues/609, but not getting an > idea on when possibly is the release timeline for officially supporting > Python 3.7. > > If you can share some rough estimates on a possible release date, it would > really help us decide our own migration plans. > > Thanks, > Surya. > _________________________________________________ > Python.NET mailing list - PythonDotNet at python.org > https://mail.python.org/mailman/listinfo/pythondotnet > -------------- next part -------------- An HTML attachment was scrubbed... URL: