From denis.akhiyarov at gmail.com Fri May 12 06:10:50 2017 From: denis.akhiyarov at gmail.com (Denis Akhiyarov) Date: Fri, 12 May 2017 05:10:50 -0500 Subject: [Python.NET] Fwd: [python-14] Using .NET assemblies from CPython with Python.NET --- PyHou Monthly Meetup 5/16 In-Reply-To: <72184414.1494564912511.JavaMail.nobody@5ecda1789e97> References: <72184414.1494564912511.JavaMail.nobody@5ecda1789e97> Message-ID: If anyone is around Houston area, feel free to join this meetup next week! ---------- Forwarded message ---------- From: Karl Ulbrich Date: Thu, May 11, 2017 at 11:55 PM Subject: [python-14] Using .NET assemblies from CPython with Python.NET --- PyHou Monthly Meetup 5/16 To: python-14-announce at meetup.com Hello Pythoneers! *Denis Akhiyarov*, a core developer and experienced user of *Python for .NET (pythonnet) *will present this month's talk. *Python for .NET (pythonnet) *is a package that gives Python programmers nearly seamless integration with the .NET 4.0+ Common Language Runtime (CLR) on Windows and Mono runtime on Linux and OSX. Python for .NET provides a powerful application scripting tool for .NET developers. Using this package you can script .NET applications or build entire applications in Python, using .NET services and components written in any language that targets the CLR (C#, VB.NET, F#, C++/CLI). For full details, visit the Meetup page here: https://www.meetup.com/python-14/events/239189223/ *When*: Tuesday, May 16, 2017 7:00 PM *Where*: Decisio Health 3900 Essex Ln. Suite #600 Houston, TX This Meetup repeats on the 3rd Tuesday of every month. If the changes affect your plans to attend, please take a moment to update your RSVP. (You can RSVP "No" or "Yes".) You can always get in touch with me through my group profile on Meetup. -- Please Note: If you hit "*REPLY*", your message will be sent to *everyone* on this mailing list (python-14 at meetup.com) This message was sent by Meetup on behalf of Karl Ulbrich from PyHou - Houston Python Enthusiasts! . To report this message, please click here To block the sender of this message, please click here To unsubscribe from special announcements from your Organizer(s), click here Meetup, POB 4668 #37895 NY NY USA 10163 <#m_5519597385249132822_> | support at meetup.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From mphielipp at gmail.com Wed May 17 19:50:12 2017 From: mphielipp at gmail.com (Mariano Phielipp) Date: Wed, 17 May 2017 16:50:12 -0700 Subject: [Python.NET] System.BadImageFormatException' in Python.Runtime.dll Message-ID: I'm running this in Visual Studio 2015 compiled in x86 mode. But I'm still getting: 'EmbeddPython.vshost.exe' (CLR v4.0.30319: EmbeddPython.vshost.exe): Loaded 'C:\Users\mjphieli\Documents\Visual Studio 2015\Projects\EmbeddPython\EmbeddPython\bin\x86\Release\Python.Runtime.dll'. Cannot find or open the PDB file. 'EmbeddPython.vshost.exe' (CLR v4.0.30319: EmbeddPython.vshost.exe): Loaded '__CodeGenerator_Assembly'. Exception thrown: 'System.BadImageFormatException' in Python.Runtime.dll 'EmbeddPython.vshost.exe' (CLR v4.0.30319: EmbeddPython.vshost.exe): Loaded 'C:\windows\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll'. Symbols loaded. The program '[56912] EmbeddPython.vshost.exe' has exited with code -1 (0xffffffff). -- Best Regards, Mariano -------------- next part -------------- An HTML attachment was scrubbed... URL: From denis.akhiyarov at gmail.com Wed May 17 22:47:46 2017 From: denis.akhiyarov at gmail.com (Denis Akhiyarov) Date: Wed, 17 May 2017 21:47:46 -0500 Subject: [Python.NET] System.BadImageFormatException' in Python.Runtime.dll In-Reply-To: References: Message-ID: We need more info such as your Python version (python --version), .NET target framework, Windows version and bitness, minimal reproducible VS solution with all dependencies. It is likely that you are using 64-bit version of pythonnet or CPython. On Wed, May 17, 2017 at 6:50 PM, Mariano Phielipp wrote: > I'm running this in Visual Studio 2015 compiled in x86 mode. But I'm still > getting: > > 'EmbeddPython.vshost.exe' (CLR v4.0.30319: EmbeddPython.vshost.exe): > Loaded 'C:\Users\mjphieli\Documents\Visual Studio > 2015\Projects\EmbeddPython\EmbeddPython\bin\x86\Release\Python.Runtime.dll'. > Cannot find or open the PDB file. > 'EmbeddPython.vshost.exe' (CLR v4.0.30319: EmbeddPython.vshost.exe): > Loaded '__CodeGenerator_Assembly'. > Exception thrown: 'System.BadImageFormatException' in Python.Runtime.dll > 'EmbeddPython.vshost.exe' (CLR v4.0.30319: EmbeddPython.vshost.exe): > Loaded 'C:\windows\Microsoft.Net\assembly\GAC_MSIL\System. > Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll'. > Symbols loaded. > The program '[56912] EmbeddPython.vshost.exe' has exited with code -1 > (0xffffffff). > > -- > Best Regards, Mariano > > _________________________________________________ > Python.NET mailing list - PythonDotNet at python.org > https://mail.python.org/mailman/listinfo/pythondotnet > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From nocman43202 at yahoo.com Fri May 19 20:11:31 2017 From: nocman43202 at yahoo.com (Matt Slezak) Date: Sat, 20 May 2017 00:11:31 +0000 (UTC) Subject: [Python.NET] Using a List with Pythonnet References: <48556168.2428164.1495239091132.ref@mail.yahoo.com> Message-ID: <48556168.2428164.1495239091132@mail.yahoo.com> I have not been able to figure out this issue - I have a C# DLL that requires a List to be populated but it appears Pythonnet returns the integer value of the Enum which does not agree with the List datatype. ?My question is posted here:?PythonNET - how to put an Enum into a List? C# NET Python?I believe there is some kind of workaround from other posts on StackExchange but I can't replicate that workaround. ?Any help would be greatly appreciated. | | | | | | | | | | | PythonNET - how to put an Enum into a List? C# NET Python I have a NET library I'm using from Python with PythonNET and can't figure out how to put an enum into a... | | | | -------------- next part -------------- An HTML attachment was scrubbed... URL: From nocman43202 at yahoo.com Sat May 20 10:39:52 2017 From: nocman43202 at yahoo.com (Matt Slezak) Date: Sat, 20 May 2017 14:39:52 +0000 (UTC) Subject: [Python.NET] Fw: Using a List with Pythonnet In-Reply-To: <48556168.2428164.1495239091132@mail.yahoo.com> References: <48556168.2428164.1495239091132.ref@mail.yahoo.com> <48556168.2428164.1495239091132@mail.yahoo.com> Message-ID: <237523671.2744855.1495291192232@mail.yahoo.com> I have not been able to figure out this issue - I have a C# DLL that requires a List to be populated but it appears Pythonnet returns the integer value of the Enum which does not agree with the List datatype. ?My question is posted here:?PythonNET - how to put an Enum into a List? C# NET Python?I believe there is some kind of workaround from other posts on StackExchange but I can't replicate that workaround. ?Any help would be greatly appreciated. | | | | | | | | | | | PythonNET - how to put an Enum into a List? C# NET Python I have a NET library I'm using from Python with PythonNET and can't figure out how to put an enum into a... | | | | -------------- next part -------------- An HTML attachment was scrubbed... URL: From denis.akhiyarov at gmail.com Sat May 20 12:50:55 2017 From: denis.akhiyarov at gmail.com (Denis Akhiyarov) Date: Sat, 20 May 2017 16:50:55 +0000 Subject: [Python.NET] Using a List with Pythonnet In-Reply-To: <48556168.2428164.1495239091132@mail.yahoo.com> References: <48556168.2428164.1495239091132.ref@mail.yahoo.com> <48556168.2428164.1495239091132@mail.yahoo.com> Message-ID: It looks like you figured out the issue based on update in stackoverflow. On Sat, May 20, 2017, 11:30 AM Matt Slezak via PythonDotNet < pythondotnet at python.org> wrote: > I have not been able to figure out this issue - I have a C# DLL that > requires a List to be populated but it appears Pythonnet returns the > integer value of the Enum which does not agree with the List > datatype. My question is posted here: PythonNET - how to put an Enum > into a List? C# NET Python > I > believe there is some kind of workaround from other posts on StackExchange > but I can't replicate that workaround. Any help would be greatly > appreciated. > > PythonNET - how to put an Enum into a List? C# NET Python > I have a NET library I'm using from Python with PythonNET and can't figure > out how to put an enum into a... > > > > _________________________________________________ > Python.NET mailing list - PythonDotNet at python.org > https://mail.python.org/mailman/listinfo/pythondotnet > -------------- next part -------------- An HTML attachment was scrubbed... URL: From nocman43202 at yahoo.com Sun May 21 11:51:47 2017 From: nocman43202 at yahoo.com (Matt Slezak) Date: Sun, 21 May 2017 15:51:47 +0000 (UTC) Subject: [Python.NET] Newbie question - does the NET DLL have to be compiled with the same compiler version as Python References: <931406237.3373067.1495381907755.ref@mail.yahoo.com> Message-ID: <931406237.3373067.1495381907755@mail.yahoo.com> I have wrapped a project and it does everything except calculate the results (blah). ?In Cython I know I had to compile Python add-ins with Visual Studio 2015 for Python 3.5. ?The NET DLL I am using was compiled with Visual Studio 2013. ?Could this be a problem? ?Or does PythonNET not care about the compiler used for DLLs? Much appreciated. Matt Slezak -------------- next part -------------- An HTML attachment was scrubbed... URL: From nocman43202 at yahoo.com Sun May 21 12:47:22 2017 From: nocman43202 at yahoo.com (Matt Slezak) Date: Sun, 21 May 2017 16:47:22 +0000 (UTC) Subject: [Python.NET] Newbie question - does the NET DLL have to be compiled with the same compiler version as Python In-Reply-To: <931406237.3373067.1495381907755@mail.yahoo.com> References: <931406237.3373067.1495381907755.ref@mail.yahoo.com> <931406237.3373067.1495381907755@mail.yahoo.com> Message-ID: <1689735755.3404691.1495385242562@mail.yahoo.com> Just FYI the error I get trying to calculate results (I have an equivalent MATLAB wrapper that works): QCLSpread.CalculateResults()Traceback (most recent call last): ? File "", line 1, in ? ? QCLSpread.CalculateResults() Exception: QCLDispatch.QclSpreadOpt? ?at QclEndurAdapter.QclSpreadOption.CalculateResults() The NET DLL was compiled with Visual Studio 2013 and Python 3.5 uses Visual Studio 2015 I don't know if that's the problem but I can recompile the NET DLL if so. ?Otherwise if anyone has ideas on how to get more information on the error that would be greatly appreciated. ?The error is not very clear in a troubleshooting sense. On Sunday, May 21, 2017 10:55 AM, Matt Slezak via PythonDotNet wrote: I have wrapped a project and it does everything except calculate the results (blah). ?In Cython I know I had to compile Python add-ins with Visual Studio 2015 for Python 3.5. ?The NET DLL I am using was compiled with Visual Studio 2013. ?Could this be a problem? ?Or does PythonNET not care about the compiler used for DLLs? Much appreciated. Matt Slezak_________________________________________________ Python.NET mailing list - PythonDotNet at python.org https://mail.python.org/mailman/listinfo/pythondotnet -------------- next part -------------- An HTML attachment was scrubbed... URL: From nocman43202 at yahoo.com Sun May 21 12:47:22 2017 From: nocman43202 at yahoo.com (Matt Slezak) Date: Sun, 21 May 2017 16:47:22 +0000 (UTC) Subject: [Python.NET] Newbie question - does the NET DLL have to be compiled with the same compiler version as Python In-Reply-To: <931406237.3373067.1495381907755@mail.yahoo.com> References: <931406237.3373067.1495381907755.ref@mail.yahoo.com> <931406237.3373067.1495381907755@mail.yahoo.com> Message-ID: <1689735755.3404691.1495385242562@mail.yahoo.com> Just FYI the error I get trying to calculate results (I have an equivalent MATLAB wrapper that works): QCLSpread.CalculateResults()Traceback (most recent call last): ? File "", line 1, in ? ? QCLSpread.CalculateResults() Exception: QCLDispatch.QclSpreadOpt? ?at QclEndurAdapter.QclSpreadOption.CalculateResults() The NET DLL was compiled with Visual Studio 2013 and Python 3.5 uses Visual Studio 2015 I don't know if that's the problem but I can recompile the NET DLL if so. ?Otherwise if anyone has ideas on how to get more information on the error that would be greatly appreciated. ?The error is not very clear in a troubleshooting sense. On Sunday, May 21, 2017 10:55 AM, Matt Slezak via PythonDotNet wrote: I have wrapped a project and it does everything except calculate the results (blah). ?In Cython I know I had to compile Python add-ins with Visual Studio 2015 for Python 3.5. ?The NET DLL I am using was compiled with Visual Studio 2013. ?Could this be a problem? ?Or does PythonNET not care about the compiler used for DLLs? Much appreciated. Matt Slezak_________________________________________________ Python.NET mailing list - PythonDotNet at python.org https://mail.python.org/mailman/listinfo/pythondotnet -------------- next part -------------- An HTML attachment was scrubbed... URL: From denis.akhiyarov at gmail.com Mon May 22 00:04:54 2017 From: denis.akhiyarov at gmail.com (Denis Akhiyarov) Date: Mon, 22 May 2017 04:04:54 +0000 Subject: [Python.NET] cx_freeze and python.net In-Reply-To: <09798747AB731042AE390DF7F282092BABD45B9F@exch-2k10.elektron.spb.su> References: <1413796413.57257.YahooMailNeo@web173106.mail.ir2.yahoo.com> <09798747AB731042AE390DF7F282092BABD45B9F@exch-2k10.elektron.spb.su> Message-ID: Hi all, Both cx_freeze and pyinstaller now come with built-in support for pythonnet (clr) hook in the most recent versions: http://cx-freeze.readthedocs.io/en/latest/releasenotes.html#version-5-0-2-may-2017 https://github.com/pyinstaller/pyinstaller/issues/1801 Thanks, Denis On Thu, Oct 23, 2014, 9:51 AM wrote: > Hello Boris, > > > > I?m not worked with cx-freeze, but I use PyInstaller, that contains hook > for clr library. This hook been broken in version 2.1, but this bug is > simply fixed (see ticket http://www.pyinstaller.org/ticket/878 and patch > here > http://www.pyinstaller.org/changeset/04eb1cf43a3dfecf8825a4a476e8639c31960a7e/project > ). I'm builded *.exe file with clr and Python.Runtime and if they placed in > same directory, all work fine. I think build the one file bundle, that > contains all needed libraries and dll?s also possible. > > > > Best regards, > > Renat Zaripov > > > > *From:* PythonDotNet [mailto:pythondotnet-bounces+zaripov= > electronxray.com at python.org] *On Behalf Of *Boris Burdin > *Sent:* Monday, October 20, 2014 1:14 PM > *To:* pythondotnet at python.org; Boris Moi > *Subject:* [Python.NET] cx_freeze and python.net > > > > Hello everybody, > > I'm trying to build a python.net application using cx-freeze . > > Once the application is built, I put in my final folder the > Python.Runtime.dll. > > but it stil doesn't seem to work . Actually, when I run the .exe file, > nothing is happening. > > So, I wonder if there were something else to do, another dll to put in the > folder, or any option to use with cx_freeze when building the application ? > > i would be very grateful if you could help me on this matter .. > > Thanks in advance, > > Boris > _________________________________________________ > Python.NET mailing list - PythonDotNet at python.org > https://mail.python.org/mailman/listinfo/pythondotnet -------------- next part -------------- An HTML attachment was scrubbed... URL: From denis.akhiyarov at gmail.com Mon May 22 09:57:50 2017 From: denis.akhiyarov at gmail.com (Denis Akhiyarov) Date: Mon, 22 May 2017 08:57:50 -0500 Subject: [Python.NET] Newbie question - does the NET DLL have to be compiled with the same compiler version as Python In-Reply-To: <1689735755.3404691.1495385242562@mail.yahoo.com> References: <931406237.3373067.1495381907755.ref@mail.yahoo.com> <931406237.3373067.1495381907755@mail.yahoo.com> <1689735755.3404691.1495385242562@mail.yahoo.com> Message-ID: If you can share equivalent calls in matlab and python to .NET DLLs we may be able to figure out what caused the error. pythonnet is not using C compiler on Windows, so VS version does not matter. What matters is .NET version (4.0+), and bitness (32-bit, 64-bit, or AnyCPU). If you were able to make calls using pythonnet to DLL and the error is on final step (CalculateResults), then it is very unlikely to have issues with compiler, etc. I suspect some method overloading differences, which you can enforce with .Overloads[] helper function: http://pythonnet.github.io/ Thanks, Denis On Sun, May 21, 2017 at 11:47 AM, Matt Slezak via PythonDotNet < pythondotnet at python.org> wrote: > Just FYI the error I get trying to calculate results (I have an equivalent > MATLAB wrapper that works): > > QCLSpread.CalculateResults() > Traceback (most recent call last): > > File "", line 1, in > QCLSpread.CalculateResults() > > Exception: QCLDispatch.QclSpreadOpt > at QclEndurAdapter.QclSpreadOption.CalculateResults() > > The NET DLL was compiled with Visual Studio 2013 and Python 3.5 uses > Visual Studio 2015 I don't know if that's the problem but I can recompile > the NET DLL if so. Otherwise if anyone has ideas on how to get more > information on the error that would be greatly appreciated. The error is > not very clear in a troubleshooting sense. > > > On Sunday, May 21, 2017 10:55 AM, Matt Slezak via PythonDotNet < > pythondotnet at python.org> wrote: > > > I have wrapped a project and it does everything except calculate the > results (blah). In Cython I know I had to compile Python add-ins with > Visual Studio 2015 for Python 3.5. The NET DLL I am using was compiled > with Visual Studio 2013. Could this be a problem? Or does PythonNET not > care about the compiler used for DLLs? > > Much appreciated. > > Matt Slezak > _________________________________________________ > 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 nocman43202 at yahoo.com Mon May 22 15:04:46 2017 From: nocman43202 at yahoo.com (Matt Slezak) Date: Mon, 22 May 2017 19:04:46 +0000 (UTC) Subject: [Python.NET] Newbie question - does the NET DLL have to be compiled with the same compiler version as Python In-Reply-To: <931406237.3373067.1495381907755@mail.yahoo.com> References: <931406237.3373067.1495381907755.ref@mail.yahoo.com> <931406237.3373067.1495381907755@mail.yahoo.com> Message-ID: <1831466760.4502258.1495479886690@mail.yahoo.com> I fixed it, it was a huge wrapper and I missed 1 variable. ?All working now. ?Testing the speed vs a MATLAB wrapper we'll see which is better. ?It would be nice if PythonNET could be put in a nogil Cython loop with prange (OpenMP) to get multiple processors, although from the FAQ looks like that's not possible. ?Best, Matt Slezak Sent from Yahoo Mail on Android On Sun, May 21, 2017 at 10:55 AM, Matt Slezak via PythonDotNet wrote: I have wrapped a project and it does everything except calculate the results (blah). ?In Cython I know I had to compile Python add-ins with Visual Studio 2015 for Python 3.5. ?The NET DLL I am using was compiled with Visual Studio 2013. ?Could this be a problem? ?Or does PythonNET not care about the compiler used for DLLs? Much appreciated. Matt Slezak_________________________________________________ Python.NET mailing list - PythonDotNet at python.org https://mail.python.org/mailman/listinfo/pythondotnet -------------- next part -------------- An HTML attachment was scrubbed... URL: From nocman43202 at yahoo.com Mon May 22 15:04:46 2017 From: nocman43202 at yahoo.com (Matt Slezak) Date: Mon, 22 May 2017 19:04:46 +0000 (UTC) Subject: [Python.NET] Newbie question - does the NET DLL have to be compiled with the same compiler version as Python In-Reply-To: <931406237.3373067.1495381907755@mail.yahoo.com> References: <931406237.3373067.1495381907755.ref@mail.yahoo.com> <931406237.3373067.1495381907755@mail.yahoo.com> Message-ID: <1831466760.4502258.1495479886690@mail.yahoo.com> I fixed it, it was a huge wrapper and I missed 1 variable. ?All working now. ?Testing the speed vs a MATLAB wrapper we'll see which is better. ?It would be nice if PythonNET could be put in a nogil Cython loop with prange (OpenMP) to get multiple processors, although from the FAQ looks like that's not possible. ?Best, Matt Slezak Sent from Yahoo Mail on Android On Sun, May 21, 2017 at 10:55 AM, Matt Slezak via PythonDotNet wrote: I have wrapped a project and it does everything except calculate the results (blah). ?In Cython I know I had to compile Python add-ins with Visual Studio 2015 for Python 3.5. ?The NET DLL I am using was compiled with Visual Studio 2013. ?Could this be a problem? ?Or does PythonNET not care about the compiler used for DLLs? Much appreciated. Matt Slezak_________________________________________________ Python.NET mailing list - PythonDotNet at python.org https://mail.python.org/mailman/listinfo/pythondotnet -------------- next part -------------- An HTML attachment was scrubbed... URL: