From chrisspen at gmail.com Tue Feb 20 17:16:35 2007 From: chrisspen at gmail.com (Chris Spencer) Date: Tue, 20 Feb 2007 11:16:35 -0500 Subject: [Python.NET] .net 2.0 - pythonnet v2.4 does not recognize any of .net 2.0 assemblies Message-ID: Make sure you're using the PythonNet/python.exe instead of Python24/python.exe. Even though the installer has an option to "give the current Python .net support", it doesn't really seem to do anything. However, using the PythonNet/python.exe, I was able to access CLR.System.String right out of the box after installing the Windows executable. Regards, Chris From chrisspen at gmail.com Tue Feb 20 17:55:17 2007 From: chrisspen at gmail.com (Chris Spencer) Date: Tue, 20 Feb 2007 11:55:17 -0500 Subject: [Python.NET] Using Third Party C# Libraries Message-ID: Hi, I'm new to Python.Net, and I'd like to access a C# library (SharpNeat) from Python. I tried placing it's DLL (SharpNeatLib.dll) into C:\Program Files\PythonNet\Lib\site-packages but when I try to import it I get the error: >>> import SharpNeatLib Traceback (most recent call last): File "", line 1, in ? ImportError: dynamic module does not define init function (initSharpNeatLib) Is there something I'm doing wrong? Any help is appreciated. Thanks, Chris From chrisspen at gmail.com Tue Feb 20 18:13:35 2007 From: chrisspen at gmail.com (Chris Spencer) Date: Tue, 20 Feb 2007 12:13:35 -0500 Subject: [Python.NET] Using Third Party C# Libraries In-Reply-To: <8674D71026D5C848831DB7CA34B1C75862F6AA@fds1wmail01.funddevelopmentservices.com> References: <8674D71026D5C848831DB7CA34B1C75862F6AA@fds1wmail01.funddevelopmentservices.com> Message-ID: I'm assuming you meant I have to replace 'TheAssembly' with some variation of SharpNeatLib.dll. Could you please be more specific? It doesn't seem to work for any combination. import CLR from CLR.System.Reflection import Assembly Assembly.LoadWithPartialName('SharpNeatLib') import CLR.SharpNeatLib Traceback (most recent call last): File "", line 1, in ? ImportError: No module named SharpNeatLib import CLR from CLR.System.Reflection import Assembly Assembly.LoadWithPartialName('SharpNeatLib.dll') import CLR.SharpNeatLib Traceback (most recent call last): File "", line 1, in ? ImportError: No module named SharpNeatLib import CLR from CLR.System.Reflection import Assembly Assembly.LoadWithPartialName('SharpNeat') import CLR.SharpNeat Traceback (most recent call last): File "", line 1, in ? ImportError: No module named SharpNeat Regards, Chris On 2/20/07, Maksim Kozyarchuk wrote: > Try the following syntax. > > import CLR > from CLR.System.Reflection import Assembly > Assembly.LoadWithPartialName('TheAssebly') > from CLR.Name.Space import ClassName > > > > > > -----Original Message----- > From: pythondotnet-bounces at python.org > [mailto:pythondotnet-bounces at python.org] On Behalf Of Chris Spencer > Sent: Tuesday, February 20, 2007 11:55 AM > To: pythondotnet at python.org > Subject: [Python.NET] Using Third Party C# Libraries > > Hi, > > I'm new to Python.Net, and I'd like to access a C# library (SharpNeat) > from Python. I tried placing it's DLL (SharpNeatLib.dll) into > C:\Program Files\PythonNet\Lib\site-packages but when I try to import > it I get the error: > > >>> import SharpNeatLib > Traceback (most recent call last): > File "", line 1, in ? > ImportError: dynamic module does not define init function > (initSharpNeatLib) > > Is there something I'm doing wrong? Any help is appreciated. > > Thanks, > Chris > _________________________________________________ > Python.NET mailing list - PythonDotNet at python.org > http://mail.python.org/mailman/listinfo/pythondotnet > From mkozyarchuk at funddevelopmentservices.com Tue Feb 20 18:03:08 2007 From: mkozyarchuk at funddevelopmentservices.com (Maksim Kozyarchuk) Date: Tue, 20 Feb 2007 12:03:08 -0500 Subject: [Python.NET] Using Third Party C# Libraries Message-ID: <8674D71026D5C848831DB7CA34B1C75862F6AA@fds1wmail01.funddevelopmentservices.com> Try the following syntax. import CLR from CLR.System.Reflection import Assembly Assembly.LoadWithPartialName('TheAssebly') from CLR.Name.Space import ClassName -----Original Message----- From: pythondotnet-bounces at python.org [mailto:pythondotnet-bounces at python.org] On Behalf Of Chris Spencer Sent: Tuesday, February 20, 2007 11:55 AM To: pythondotnet at python.org Subject: [Python.NET] Using Third Party C# Libraries Hi, I'm new to Python.Net, and I'd like to access a C# library (SharpNeat) from Python. I tried placing it's DLL (SharpNeatLib.dll) into C:\Program Files\PythonNet\Lib\site-packages but when I try to import it I get the error: >>> import SharpNeatLib Traceback (most recent call last): File "", line 1, in ? ImportError: dynamic module does not define init function (initSharpNeatLib) Is there something I'm doing wrong? Any help is appreciated. Thanks, Chris _________________________________________________ Python.NET mailing list - PythonDotNet at python.org http://mail.python.org/mailman/listinfo/pythondotnet From mkozyarchuk at funddevelopmentservices.com Tue Feb 20 18:19:33 2007 From: mkozyarchuk at funddevelopmentservices.com (Maksim Kozyarchuk) Date: Tue, 20 Feb 2007 12:19:33 -0500 Subject: [Python.NET] Using Third Party C# Libraries Message-ID: <8674D71026D5C848831DB7CA34B1C75862F6AB@fds1wmail01.funddevelopmentservices.com> Yes. The Assembly would be SharpNeatLib, in order for this to work you need to place SharpNeatLib.dll into your PYTHON_PATH or the GAC. import CLR from CLR.System.Reflection import Assembly Assembly.LoadWithPartialName('SharpNeatLib') from CLR.Name.Space import ClassName Maksim -----Original Message----- From: Chris Spencer [mailto:chrisspen at gmail.com] Sent: Tuesday, February 20, 2007 12:14 PM To: Maksim Kozyarchuk Cc: pythondotnet at python.org Subject: Re: [Python.NET] Using Third Party C# Libraries I'm assuming you meant I have to replace 'TheAssembly' with some variation of SharpNeatLib.dll. Could you please be more specific? It doesn't seem to work for any combination. import CLR from CLR.System.Reflection import Assembly Assembly.LoadWithPartialName('SharpNeatLib') import CLR.SharpNeatLib Traceback (most recent call last): File "", line 1, in ? ImportError: No module named SharpNeatLib import CLR from CLR.System.Reflection import Assembly Assembly.LoadWithPartialName('SharpNeatLib.dll') import CLR.SharpNeatLib Traceback (most recent call last): File "", line 1, in ? ImportError: No module named SharpNeatLib import CLR from CLR.System.Reflection import Assembly Assembly.LoadWithPartialName('SharpNeat') import CLR.SharpNeat Traceback (most recent call last): File "", line 1, in ? ImportError: No module named SharpNeat Regards, Chris On 2/20/07, Maksim Kozyarchuk wrote: > Try the following syntax. > > import CLR > from CLR.System.Reflection import Assembly > Assembly.LoadWithPartialName('TheAssebly') > from CLR.Name.Space import ClassName > > > > > > -----Original Message----- > From: pythondotnet-bounces at python.org > [mailto:pythondotnet-bounces at python.org] On Behalf Of Chris Spencer > Sent: Tuesday, February 20, 2007 11:55 AM > To: pythondotnet at python.org > Subject: [Python.NET] Using Third Party C# Libraries > > Hi, > > I'm new to Python.Net, and I'd like to access a C# library (SharpNeat) > from Python. I tried placing it's DLL (SharpNeatLib.dll) into > C:\Program Files\PythonNet\Lib\site-packages but when I try to import > it I get the error: > > >>> import SharpNeatLib > Traceback (most recent call last): > File "", line 1, in ? > ImportError: dynamic module does not define init function > (initSharpNeatLib) > > Is there something I'm doing wrong? Any help is appreciated. > > Thanks, > Chris > _________________________________________________ > Python.NET mailing list - PythonDotNet at python.org > http://mail.python.org/mailman/listinfo/pythondotnet > From chrisspen at gmail.com Tue Feb 20 18:59:19 2007 From: chrisspen at gmail.com (Chris Spencer) Date: Tue, 20 Feb 2007 12:59:19 -0500 Subject: [Python.NET] Using Third Party C# Libraries In-Reply-To: <8674D71026D5C848831DB7CA34B1C75862F6AB@fds1wmail01.funddevelopmentservices.com> References: <8674D71026D5C848831DB7CA34B1C75862F6AB@fds1wmail01.funddevelopmentservices.com> Message-ID: I've copied SharpNeatLib.dll to C:\Program Files\PythonNet, C:\Program Files\PythonNet\Lib, C:\Program Files\PythonNet\Lib\site-packages, C:\Program Files\Python24, C:\Program Files\Python24\Lib, and C:\Program Files\Python24\Lib\site-packages but it still raises that exception "ImportError: cannot import name SharpNeatLib". Using Assembly.Load("SharpNeatLib.dll") raises a different exception: >>> Assembly.Load('SharpNeatLib.dll') Traceback (most recent call last): File "", line 1, in ? CLR.System.BadImageFormatException: Version 2.0 is not a compatible version. at System.Reflection.Assembly.nLoadImage(Byte[] rawAssembly, Byte[] rawSymbol Store, Evidence evidence, StackCrawlMark& stackMark) at System.Reflection.Assembly.Load(Byte[] rawAssembly) Would this indicate that the SharpNeatLib.dll was built with a C# compiler incompatible with what Python.Net was built with? Chris On 2/20/07, Maksim Kozyarchuk wrote: > > Yes. The Assembly would be SharpNeatLib, in order for this to > work you need to place SharpNeatLib.dll into your PYTHON_PATH or the > GAC. > > import CLR > from CLR.System.Reflection import Assembly > Assembly.LoadWithPartialName('SharpNeatLib') > from CLR.Name.Space import ClassName > > Maksim > > -----Original Message----- > From: Chris Spencer [mailto:chrisspen at gmail.com] > Sent: Tuesday, February 20, 2007 12:14 PM > To: Maksim Kozyarchuk > Cc: pythondotnet at python.org > Subject: Re: [Python.NET] Using Third Party C# Libraries > > I'm assuming you meant I have to replace 'TheAssembly' with some > variation of SharpNeatLib.dll. Could you please be more specific? It > doesn't seem to work for any combination. > > import CLR > from CLR.System.Reflection import Assembly > Assembly.LoadWithPartialName('SharpNeatLib') > import CLR.SharpNeatLib > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named SharpNeatLib > > import CLR > from CLR.System.Reflection import Assembly > Assembly.LoadWithPartialName('SharpNeatLib.dll') > import CLR.SharpNeatLib > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named SharpNeatLib > > import CLR > from CLR.System.Reflection import Assembly > Assembly.LoadWithPartialName('SharpNeat') > import CLR.SharpNeat > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named SharpNeat > > Regards, > Chris > > On 2/20/07, Maksim Kozyarchuk > wrote: > > Try the following syntax. > > > > import CLR > > from CLR.System.Reflection import Assembly > > Assembly.LoadWithPartialName('TheAssebly') > > from CLR.Name.Space import ClassName > > > > > > > > > > > > -----Original Message----- > > From: pythondotnet-bounces at python.org > > [mailto:pythondotnet-bounces at python.org] On Behalf Of Chris Spencer > > Sent: Tuesday, February 20, 2007 11:55 AM > > To: pythondotnet at python.org > > Subject: [Python.NET] Using Third Party C# Libraries > > > > Hi, > > > > I'm new to Python.Net, and I'd like to access a C# library (SharpNeat) > > from Python. I tried placing it's DLL (SharpNeatLib.dll) into > > C:\Program Files\PythonNet\Lib\site-packages but when I try to import > > it I get the error: > > > > >>> import SharpNeatLib > > Traceback (most recent call last): > > File "", line 1, in ? > > ImportError: dynamic module does not define init function > > (initSharpNeatLib) > > > > Is there something I'm doing wrong? Any help is appreciated. > > > > Thanks, > > Chris > > _________________________________________________ > > Python.NET mailing list - PythonDotNet at python.org > > http://mail.python.org/mailman/listinfo/pythondotnet > > > From mkozyarchuk at funddevelopmentservices.com Tue Feb 20 19:05:54 2007 From: mkozyarchuk at funddevelopmentservices.com (Maksim Kozyarchuk) Date: Tue, 20 Feb 2007 13:05:54 -0500 Subject: [Python.NET] Using Third Party C# Libraries Message-ID: <8674D71026D5C848831DB7CA34B1C75862F6AD@fds1wmail01.funddevelopmentservices.com> Haven't seen this before. Sorry. Do you have .NET 2.0 installed on your machine? -----Original Message----- From: Chris Spencer [mailto:chrisspen at gmail.com] Sent: Tuesday, February 20, 2007 12:59 PM To: Maksim Kozyarchuk Cc: pythondotnet at python.org Subject: Re: [Python.NET] Using Third Party C# Libraries I've copied SharpNeatLib.dll to C:\Program Files\PythonNet, C:\Program Files\PythonNet\Lib, C:\Program Files\PythonNet\Lib\site-packages, C:\Program Files\Python24, C:\Program Files\Python24\Lib, and C:\Program Files\Python24\Lib\site-packages but it still raises that exception "ImportError: cannot import name SharpNeatLib". Using Assembly.Load("SharpNeatLib.dll") raises a different exception: >>> Assembly.Load('SharpNeatLib.dll') Traceback (most recent call last): File "", line 1, in ? CLR.System.BadImageFormatException: Version 2.0 is not a compatible version. at System.Reflection.Assembly.nLoadImage(Byte[] rawAssembly, Byte[] rawSymbol Store, Evidence evidence, StackCrawlMark& stackMark) at System.Reflection.Assembly.Load(Byte[] rawAssembly) Would this indicate that the SharpNeatLib.dll was built with a C# compiler incompatible with what Python.Net was built with? Chris On 2/20/07, Maksim Kozyarchuk wrote: > > Yes. The Assembly would be SharpNeatLib, in order for this to > work you need to place SharpNeatLib.dll into your PYTHON_PATH or the > GAC. > > import CLR > from CLR.System.Reflection import Assembly > Assembly.LoadWithPartialName('SharpNeatLib') > from CLR.Name.Space import ClassName > > Maksim > > -----Original Message----- > From: Chris Spencer [mailto:chrisspen at gmail.com] > Sent: Tuesday, February 20, 2007 12:14 PM > To: Maksim Kozyarchuk > Cc: pythondotnet at python.org > Subject: Re: [Python.NET] Using Third Party C# Libraries > > I'm assuming you meant I have to replace 'TheAssembly' with some > variation of SharpNeatLib.dll. Could you please be more specific? It > doesn't seem to work for any combination. > > import CLR > from CLR.System.Reflection import Assembly > Assembly.LoadWithPartialName('SharpNeatLib') > import CLR.SharpNeatLib > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named SharpNeatLib > > import CLR > from CLR.System.Reflection import Assembly > Assembly.LoadWithPartialName('SharpNeatLib.dll') > import CLR.SharpNeatLib > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named SharpNeatLib > > import CLR > from CLR.System.Reflection import Assembly > Assembly.LoadWithPartialName('SharpNeat') > import CLR.SharpNeat > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named SharpNeat > > Regards, > Chris > > On 2/20/07, Maksim Kozyarchuk > wrote: > > Try the following syntax. > > > > import CLR > > from CLR.System.Reflection import Assembly > > Assembly.LoadWithPartialName('TheAssebly') > > from CLR.Name.Space import ClassName > > > > > > > > > > > > -----Original Message----- > > From: pythondotnet-bounces at python.org > > [mailto:pythondotnet-bounces at python.org] On Behalf Of Chris Spencer > > Sent: Tuesday, February 20, 2007 11:55 AM > > To: pythondotnet at python.org > > Subject: [Python.NET] Using Third Party C# Libraries > > > > Hi, > > > > I'm new to Python.Net, and I'd like to access a C# library (SharpNeat) > > from Python. I tried placing it's DLL (SharpNeatLib.dll) into > > C:\Program Files\PythonNet\Lib\site-packages but when I try to import > > it I get the error: > > > > >>> import SharpNeatLib > > Traceback (most recent call last): > > File "", line 1, in ? > > ImportError: dynamic module does not define init function > > (initSharpNeatLib) > > > > Is there something I'm doing wrong? Any help is appreciated. > > > > Thanks, > > Chris > > _________________________________________________ > > Python.NET mailing list - PythonDotNet at python.org > > http://mail.python.org/mailman/listinfo/pythondotnet > > > From chrisspen at gmail.com Tue Feb 20 19:10:01 2007 From: chrisspen at gmail.com (Chris Spencer) Date: Tue, 20 Feb 2007 13:10:01 -0500 Subject: [Python.NET] Using Third Party C# Libraries In-Reply-To: <8674D71026D5C848831DB7CA34B1C75862F6AD@fds1wmail01.funddevelopmentservices.com> References: <8674D71026D5C848831DB7CA34B1C75862F6AD@fds1wmail01.funddevelopmentservices.com> Message-ID: Yes, I have the .NET Framework SDK for both 1.1 and 2.0 installed. On 2/20/07, Maksim Kozyarchuk wrote: > > Haven't seen this before. Sorry. > > > Do you have .NET 2.0 installed on your machine? > > > -----Original Message----- > From: Chris Spencer [mailto:chrisspen at gmail.com] > Sent: Tuesday, February 20, 2007 12:59 PM > To: Maksim Kozyarchuk > Cc: pythondotnet at python.org > Subject: Re: [Python.NET] Using Third Party C# Libraries > > I've copied SharpNeatLib.dll to C:\Program Files\PythonNet, C:\Program > Files\PythonNet\Lib, C:\Program Files\PythonNet\Lib\site-packages, > C:\Program Files\Python24, C:\Program Files\Python24\Lib, and > C:\Program Files\Python24\Lib\site-packages but it still raises that > exception "ImportError: cannot import name SharpNeatLib". > > Using Assembly.Load("SharpNeatLib.dll") raises a different exception: > > >>> Assembly.Load('SharpNeatLib.dll') > Traceback (most recent call last): > File "", line 1, in ? > CLR.System.BadImageFormatException: Version 2.0 is not a compatible > version. > at System.Reflection.Assembly.nLoadImage(Byte[] rawAssembly, Byte[] > rawSymbol > Store, Evidence evidence, StackCrawlMark& stackMark) > at System.Reflection.Assembly.Load(Byte[] rawAssembly) > > Would this indicate that the SharpNeatLib.dll was built with a C# > compiler incompatible with what Python.Net was built with? > > Chris From dvpdiner2 at yahoo.com Wed Feb 21 00:27:20 2007 From: dvpdiner2 at yahoo.com (Darryl Pogue) Date: Tue, 20 Feb 2007 15:27:20 -0800 (PST) Subject: [Python.NET] Using Third Party C# Libraries Message-ID: <179733.80031.qm@web31601.mail.mud.yahoo.com> This is a problem with the current installer for Python.NET: It doesn't have support for .NET 2.0. You'll need to compile from source (which is quite easy) in order to get 2.0 support (and support for 2.0 DLLs) Hopefully someone will have gotten around to fixing the ClrModule so that Python .NET will compile properly for 2.0. Uru Live IRC Chat: unreal.JustIRC.net #uru ----- Original Message ---- From: Chris Spencer To: pythondotnet at python.org Sent: Tuesday, February 20, 2007 10:10:01 AM Subject: Re: [Python.NET] Using Third Party C# Libraries Yes, I have the .NET Framework SDK for both 1.1 and 2.0 installed. On 2/20/07, Maksim Kozyarchuk wrote: > > Haven't seen this before. Sorry. > > > Do you have .NET 2.0 installed on your machine? > > > -----Original Message----- > From: Chris Spencer [mailto:chrisspen at gmail.com] > Sent: Tuesday, February 20, 2007 12:59 PM > To: Maksim Kozyarchuk > Cc: pythondotnet at python.org > Subject: Re: [Python.NET] Using Third Party C# Libraries > > I've copied SharpNeatLib.dll to C:\Program Files\PythonNet, C:\Program > Files\PythonNet\Lib, C:\Program Files\PythonNet\Lib\site-packages, > C:\Program Files\Python24, C:\Program Files\Python24\Lib, and > C:\Program Files\Python24\Lib\site-packages but it still raises that > exception "ImportError: cannot import name SharpNeatLib". > > Using Assembly.Load("SharpNeatLib.dll") raises a different exception: > > >>> Assembly.Load('SharpNeatLib.dll') > Traceback (most recent call last): > File "", line 1, in ? > CLR.System.BadImageFormatException: Version 2.0 is not a compatible > version. > at System.Reflection.Assembly.nLoadImage(Byte[] rawAssembly, Byte[] > rawSymbol > Store, Evidence evidence, StackCrawlMark& stackMark) > at System.Reflection.Assembly.Load(Byte[] rawAssembly) > > Would this indicate that the SharpNeatLib.dll was built with a C# > compiler incompatible with what Python.Net was built with? > > Chris _________________________________________________ Python.NET mailing list - PythonDotNet at python.org http://mail.python.org/mailman/listinfo/pythondotnet __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/pythondotnet/attachments/20070220/50943fd8/attachment.htm From jvm_cop at spamcop.net Wed Feb 21 01:06:09 2007 From: jvm_cop at spamcop.net (J. Merrill) Date: Tue, 20 Feb 2007 19:06:09 -0500 Subject: [Python.NET] Using Third Party C# Libraries In-Reply-To: References: <8674D71026D5C848831DB7CA34B1C75862F6AA@fds1wmail01.funddevelopmentservices.com> Message-ID: <7.0.1.0.2.20070220185853.05a47908@wheresmymailserver.com> Even if you get a 1.1-compatible version of the DLL, or you build Python.Net 2 from source, you will need to learn the namespace(s) and name(s) of the C# class(es) you want to use. From what you have below, it seems that the LoadWithPartialName call worked (so you don't need to copy the DLL to everywhere in the file system) but the import didn't. You need to know the name of the C# namespace and class to import -- as Maksim wrote from CLR.Name.Space import ClassName For you that would probably be something like from CLR.SharpNeatVendorName.SharpNeat import MainClass assuming that they follow the convention of putting their work in a namespace under a namespace based on their company/organization name. The magic of Python.Net's CLR module is that it makes the C# DLL available dynamically -- but you have to know the namespace(s) and class(es). At 12:13 PM 2/20/2007, Chris Spencer wrote >I'm assuming you meant I have to replace 'TheAssembly' with some >variation of SharpNeatLib.dll. Could you please be more specific? It >doesn't seem to work for any combination. > >import CLR >from CLR.System.Reflection import Assembly >Assembly.LoadWithPartialName('SharpNeatLib') >import CLR.SharpNeatLib >Traceback (most recent call last): > File "", line 1, in ? >ImportError: No module named SharpNeatLib > >import CLR >from CLR.System.Reflection import Assembly >Assembly.LoadWithPartialName('SharpNeatLib.dll') >import CLR.SharpNeatLib >Traceback (most recent call last): > File "", line 1, in ? >ImportError: No module named SharpNeatLib > >import CLR >from CLR.System.Reflection import Assembly >Assembly.LoadWithPartialName('SharpNeat') >import CLR.SharpNeat >Traceback (most recent call last): > File "", line 1, in ? >ImportError: No module named SharpNeat > >Regards, >Chris > >On 2/20/07, Maksim Kozyarchuk wrote: >> Try the following syntax. >> >> import CLR >> from CLR.System.Reflection import Assembly >> Assembly.LoadWithPartialName('TheAssebly') >> from CLR.Name.Space import ClassName >> >> >> >> >> >> -----Original Message----- >> From: pythondotnet-bounces at python.org >> [mailto:pythondotnet-bounces at python.org] On Behalf Of Chris Spencer >> Sent: Tuesday, February 20, 2007 11:55 AM >> To: pythondotnet at python.org >> Subject: [Python.NET] Using Third Party C# Libraries >> >> Hi, >> >> I'm new to Python.Net, and I'd like to access a C# library (SharpNeat) >> from Python. I tried placing it's DLL (SharpNeatLib.dll) into >> C:\Program Files\PythonNet\Lib\site-packages but when I try to import >> it I get the error: >> >> >>> import SharpNeatLib >> Traceback (most recent call last): >> File "", line 1, in ? >> ImportError: dynamic module does not define init function >> (initSharpNeatLib) >> >> Is there something I'm doing wrong? Any help is appreciated. >> >> Thanks, >> Chris J. Merrill / Analytical Software Corp From jvm_cop at spamcop.net Wed Feb 21 01:44:40 2007 From: jvm_cop at spamcop.net (J. Merrill) Date: Tue, 20 Feb 2007 19:44:40 -0500 Subject: [Python.NET] Using Third Party C# Libraries In-Reply-To: <179733.80031.qm@web31601.mail.mud.yahoo.com> References: <179733.80031.qm@web31601.mail.mud.yahoo.com> Message-ID: <7.0.1.0.2.20070220190623.05bb5980@wheresmymailserver.com> Someone who needed Python.NET to work under 2.0 (Michael Eddington) provides a binary rendition of Python.Net for .Net 2.0. I have not played with it but you can download it from SourceForge. http://sourceforge.net/project/showfiles.php?group_id=149840&package_id=181323&release_id=396953 There are two .zip files in the file; in theory you only need the binary. This link should download the binary only: http://downloads.sourceforge.net/peachfuzz/PythonNET2.0-0.2-bin.zip?modtime=1140965963&big_mirror=0 Good luck. (Please let me know if this works!) At 06:27 PM 2/20/2007, Darryl Pogue wrote (in part) >This is a problem with the current installer for Python.NET: It doesn't have support for .NET 2.0. > >You'll need to compile from source (which is quite easy) in order to get 2.0 support (and support for 2.0 DLLs) > >Hopefully someone will have gotten around to fixing the ClrModule so that Python .NET will compile properly for 2.0. [snip] J. Merrill / Analytical Software Corp From chrisspen at gmail.com Thu Feb 22 05:49:24 2007 From: chrisspen at gmail.com (Chris Spencer) Date: Wed, 21 Feb 2007 23:49:24 -0500 Subject: [Python.NET] Running with Mono? Message-ID: Trying to run python.exe from pythonnet-1.0-rc2-py2.4-clr1.1-src.tgz on Fedora with Mono 1.1.13, and I'm getting this message: err:module:import_dll Library mscoree.dll (which is needed by L"Z:\\pythonnet-1.0-rc2-py2.4-clr1.1-src\\python.exe") not found err:module:LdrInitializeThunk Main exe initialization for L"Z:\\pythonnet-1.0-rc2-py2.4-clr1.1-src\\python.exe" failed, status c0000135 The site says PythonNet should run on Mono. I followed the instructions in readme.html. Is there anything else I need to do? Regards, Chris From aemphil at gmail.com Sat Feb 24 02:51:40 2007 From: aemphil at gmail.com (Philippe Le Grand) Date: Fri, 23 Feb 2007 19:51:40 -0600 Subject: [Python.NET] Circular dependencies Message-ID: <3927aa550702231751y3d2ad620q6014e0d1ee0dbe3c@mail.gmail.com> Hello All. I just checked out Python.Net from SVN and attempted to recompile it, but I ran into an apparent circular dependency problem: Python.Runtime.dll requires the ClrModule class, from clr.dll, but clr.dll needs Python.Runtime.dll to build. Am I doing something wrong? Philippe From angel.ignacio.colmenares at gmail.com Sun Feb 25 17:45:15 2007 From: angel.ignacio.colmenares at gmail.com (angel ignacio colmenares laguado) Date: Sun, 25 Feb 2007 11:45:15 -0500 Subject: [Python.NET] Using Third Party C# Libraries Message-ID: <3f37f8c90702250845v1a61c207s36fb9dc6a8a81d8f@mail.gmail.com> for Python.NET support for .NET 2.0: 1. Download de latest source from http://pythonnet.svn.sourceforge.net/viewvc/pythonnet/trunk/ (you can use Tortoise SVN in win*) 2. change in importhook.cs : line 25 static *Clr*Module clr; with static *clr*Module clr; line 50 clr = new *Clr*Module("clr"); with clr = new *clr*Module(); line 51 Runtime.PyDict_SetItemString(dict, "clr", *clr*.pyHandle); with Runtime.PyDict_SetItemString(dict, "clr", *root*.pyHandle); line 111: Runtime.Incref(*clr*.pyHandle); with Runtime.Incref(*root*.pyHandle); line 112: return *clr*.pyHandle; with return *root*.pyHandle; 3. Change makefile with this: ILDASM=ildasm.exe ILASM=/c/WINDOWS/Microsoft.NET/Framework/v2.0.50727/ilasm.exe CSC=/c/WINDOWS/Microsoft.NET/Framework/v2.0.50727/csc.exe all: python.exe python.exe: Python.Runtime.dll cd src; cd console; \ $(CSC) -nologo -target:exe -out:../../python.exe \ -reference:../../Python.Runtime.dll -recurse:*.cs cd ..; cd ..; Python.Runtime.dll:clr.dll cd src; cd runtime; \ $(CSC) -nologo -unsafe -target:library -out:../../Python.Runtime.dll \ -reference:clr.dll \ * -recurse:*.cs cd ..; cd ..; *clr.dll: $(ILASM) -nologo -dll -quiet -output=clr.dll \ ./src/runtime/clrmodule.il; 4. using Mingw32 (msys) execute: makefile you get :Python.Runtime.dll, clr.dll and pyton.exe ready for net 2.0 5. put Python.Runtime.dll and crl.dll in your python24 directory. 6. you can get ready binaries (Python.Runtime.dll , clr.dll and pyton.exe) for Net 2.0 from : http://angel.ignacio.colmenares.googlepages.com/pythonnet 7. Some screenshots in : http://angel.ignacio.colmenares.googlepages.com/pythonnet* * angel ignacio colmenares laguado -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/pythondotnet/attachments/20070225/0f8128e3/attachment.htm From angel.ignacio.colmenares at gmail.com Sun Feb 25 17:25:01 2007 From: angel.ignacio.colmenares at gmail.com (angel ignacio colmenares laguado) Date: Sun, 25 Feb 2007 11:25:01 -0500 Subject: [Python.NET] Using Third Party C# Libraries Message-ID: <3f37f8c90702250825x3a1e77c0ueb891b7c3b0c3245@mail.gmail.com> for Python.NET support for .NET 2.0: 1. Download de latest source from http://pythonnet.svn.sourceforge.net/viewvc/pythonnet/trunk/ (you can use Tortoise SVN in win*) 2. change in importhook.cs : line 25 static *Clr*Module clr; with static *clr*Module clr; line 50 clr = new *Clr*Module("clr"); with clr = new *clr*Module(); line 51 Runtime.PyDict_SetItemString(dict, "clr", *clr*.pyHandle); with Runtime.PyDict_SetItemString(dict, "clr", *root*.pyHandle); line 111: Runtime.Incref(*clr*.pyHandle); with Runtime.Incref(*root*.pyHandle); line 112: return *clr*.pyHandle; with return *root*.pyHandle; 3. Change makefile with this: ILDASM=ildasm.exe ILASM=/c/WINDOWS/Microsoft.NET/Framework/v2.0.50727/ilasm.exe CSC=/c/WINDOWS/Microsoft.NET/Framework/v2.0.50727/csc.exe all: python.exe python.exe: Python.Runtime.dll cd src; cd console; \ $(CSC) -nologo -target:exe -out:../../python.exe \ -reference:../../Python.Runtime.dll -recurse:*.cs cd ..; cd ..; Python.Runtime.dll:clr.dll cd src; cd runtime; \ $(CSC) -nologo -unsafe -target:library -out:../../Python.Runtime.dll \ -reference:clr.dll \ * -recurse:*.cs cd ..; cd ..; *clr.dll: $(ILASM) -nologo -dll -quiet -output=clr.dll \ ./src/runtime/clrmodule.il; 4. using Mingw32 (msys) execute: makefile you get :Python.Runtime.dll, clr.dll and pyton.exe ready for net 2.0 5. put Python.Runtime.dll and crl.dll in your python24 directory. 6. you can get ready binaries (Python.Runtime.dll, clr.dll and pyton.exe) for Net 2.0 from : http://angel.ignacio.colmenares.googlepages.com/pythonnet 7. Some screenshots in : http://angel.ignacio.colmenares.googlepages.com/pythonnet* * angel ignacio colmenares laguado -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/pythondotnet/attachments/20070225/a5da2210/attachment.html