From jhargraveiii at comcast.net Fri Mar 2 07:32:44 2007 From: jhargraveiii at comcast.net (Jim Hargrave) Date: Thu, 01 Mar 2007 23:32:44 -0700 Subject: [Python.NET] Using Third Party C# Libraries In-Reply-To: <3f37f8c90702250845v1a61c207s36fb9dc6a8a81d8f@mail.gmail.com> References: <3f37f8c90702250845v1a61c207s36fb9dc6a8a81d8f@mail.gmail.com> Message-ID: I installed the Python.Net for 2.0 (pre-compiles binaries) from the link below. But I am unable to get this working: >>> import clr # this works >>> clr.AddReference("System.Windows.Forms") Traceback (most recent call last): File "", line 1, in ? AttributeError: AddReference According to the readme file this is supposed to work and matches up with the IronPython syntax. Am I doing something wrong? I copied the Python.Net for 2.0 binaries over my Python 2.4 install (overwriting my python.exe). All sample Python.NET files worked fine - but they use the old "CLR" syntax. Jim angel ignacio colmenares laguado wrote: > 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 > > > ------------------------------------------------------------------------ > > _________________________________________________ > Python.NET mailing list - PythonDotNet at python.org > http://mail.python.org/mailman/listinfo/pythondotnet From angel.ignacio.colmenares at gmail.com Fri Mar 2 16:30:12 2007 From: angel.ignacio.colmenares at gmail.com (angel ignacio colmenares laguado) Date: Fri, 2 Mar 2007 09:30:12 -0600 Subject: [Python.NET] Using Third Party C# Libraries In-Reply-To: References: <3f37f8c90702250845v1a61c207s36fb9dc6a8a81d8f@mail.gmail.com> Message-ID: <3f37f8c90703020730r54be2e66i56942a56d41ce770@mail.gmail.com> 1. yes, you are rigth , clr.AddReference does not work ( there is not method AddReference in clr.dll nor PythonRuntime.dll). But you cant do this: >>>import clr >>>import System.Windows.Forms as WinForms >>>from System.Drawing import Size, Point >>>f=WinForms.Form() >>>f.Text = "Hello World From Python" >>>f.AutoScaleBaseSize = Size(5, 13) >>>f.ClientSize = Size(392, 117) >>>h = WinForms.SystemInformation.CaptionHeight >>>f.MinimumSize = Size(392, (117 + h)) >>>f.dgv=WinForms.DataGridView() >>>f.dgv.Location = Point(2, 2) >>>button = WinForms.Button() >>>button.Location = Point(256, 64) >>>button.Text = "Click Me!" >>>f.Controls.Add(button) >>>f.Controls.Add(f.dgv) >>>WinForms.Application.Run(f) # import Config class from Nini.dll assembly >>>import Nini.Config as config >>>config= Config.XmlConfigSource("DbManager.xml") >>>print config.Configs["firebird2.0"].Get("providerName") FirebirdSql.Data.FirebirdClient # import class FirebirdMetaData from Mono.Data.SqlSharp.DatabaseBrowser.dll >>>from Mono.Data.SqlSharp.DatabaseBrowser import FirebirdMetaData >>>me=FirebirdMetaData() >>>print me Mono.Data.SqlSharp.DatabaseBrowser.FirebirdMetaData >>>me.ToString() Mono.Data.SqlSharp.DatabaseBrowser.FirebirdMetaData 2. yes the old CLR still works from CLR.System.Reflection import Assembly print Assembly for samples checkout http://pythonnet.svn.sourceforge.net/viewvc/pythonnet/trunk/pythonnet/demo/ angel ignacio 2007/3/2, Jim Hargrave : > > I installed the Python.Net for 2.0 (pre-compiles binaries) from the link > below. But I am unable to get this working: > > >>> import clr # this works > >>> clr.AddReference("System.Windows.Forms") > Traceback (most recent call last): > File "", line 1, in ? > AttributeError: AddReference > > According to the readme file this is supposed to work and matches up > with the IronPython syntax. Am I doing something wrong? > > I copied the Python.Net for 2.0 binaries over my Python 2.4 install > (overwriting my python.exe). > > All sample Python.NET files worked fine - but they use the old "CLR" > syntax. > > Jim > > > angel ignacio colmenares laguado wrote: > > 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 > > > > > > ------------------------------------------------------------------------ > > > > _________________________________________________ > > Python.NET mailing list - PythonDotNet at python.org > > http://mail.python.org/mailman/listinfo/pythondotnet > > _________________________________________________ > Python.NET mailing list - PythonDotNet at python.org > http://mail.python.org/mailman/listinfo/pythondotnet > -- Atentamente, angel ignacio colmenares laguado -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/pythondotnet/attachments/20070302/b8ef3a78/attachment.html From pmartin at snakecard.com Fri Mar 2 09:19:24 2007 From: pmartin at snakecard.com (Philippe C. Martin) Date: Fri, 2 Mar 2007 09:19:24 +0100 Subject: [Python.NET] PythonDotNet Digest, Vol 41, Issue 1 In-Reply-To: References: Message-ID: <200703020919.24637.pmartin@snakecard.com> 1) do what you want 2) stick to your word 3) let him breathe 4) keep me out of this On Friday 2 March 2007 12:00, pythondotnet-request at python.org wrote: > Send PythonDotNet mailing list submissions to > pythondotnet at python.org > > To subscribe or unsubscribe via the World Wide Web, visit > http://mail.python.org/mailman/listinfo/pythondotnet > or, via email, send a message with subject or body 'help' to > pythondotnet-request at python.org > > You can reach the person managing the list at > pythondotnet-owner at python.org > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of PythonDotNet digest..." > > > Today's Topics: > > 1. Re: Using Third Party C# Libraries (Jim Hargrave) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Thu, 01 Mar 2007 23:32:44 -0700 > From: Jim Hargrave > Subject: Re: [Python.NET] Using Third Party C# Libraries > To: pythondotnet at python.org > Message-ID: > Content-Type: text/plain; charset=ISO-8859-1; format=flowed > > I installed the Python.Net for 2.0 (pre-compiles binaries) from the link > > below. But I am unable to get this working: > >>> import clr # this works > >>> clr.AddReference("System.Windows.Forms") > > Traceback (most recent call last): > File "", line 1, in ? > AttributeError: AddReference > > According to the readme file this is supposed to work and matches up > with the IronPython syntax. Am I doing something wrong? > > I copied the Python.Net for 2.0 binaries over my Python 2.4 install > (overwriting my python.exe). > > All sample Python.NET files worked fine - but they use the old "CLR" > syntax. > > Jim > > angel ignacio colmenares laguado wrote: > > 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 > > > > > > ------------------------------------------------------------------------ > > > > _________________________________________________ > > Python.NET mailing list - PythonDotNet at python.org > > http://mail.python.org/mailman/listinfo/pythondotnet > > ------------------------------ > > _______________________________________________ > PythonDotNet mailing list > PythonDotNet at python.org > http://mail.python.org/mailman/listinfo/pythondotnet > > > End of PythonDotNet Digest, Vol 41, Issue 1 > ******************************************* -- _________________________ Philippe C. Martin +1 405 562 7005 www.snakecard.com _________________________ From brian.lloyd at revolution.com Fri Mar 2 17:52:04 2007 From: brian.lloyd at revolution.com (Brian Lloyd) Date: Fri, 02 Mar 2007 11:52:04 -0500 Subject: [Python.NET] Using Third Party C# Libraries In-Reply-To: <3f37f8c90703020730r54be2e66i56942a56d41ce770@mail.gmail.com> Message-ID: Sorry about that ? someone had asked for info on using generics so I put up in-progress documentation for the next rev and haven?t had time to work on making some of the stuff true yet :( I?ll try to at least get the docs to a sane state to avoid confusion over the weekend. -Brian On 3/2/07 10:30 AM, "angel ignacio colmenares laguado" wrote: > 1. yes, you are rigth , clr.AddReference does not work ( there is not method > AddReference in clr.dll nor PythonRuntime.dll). > > But you cant do this: > >>>> >>>import clr >>>> >>>import System.Windows.Forms as WinForms >>>> >>>from System.Drawing import Size, Point >>>> >>>f=WinForms.Form() >>>> >>>f.Text = "Hello World From Python" >>>> >>>f.AutoScaleBaseSize = Size(5, 13) >>>> >>> f.ClientSize = Size(392, 117) >>>> >>>h = WinForms.SystemInformation.CaptionHeight >>>> >>>f.MinimumSize = Size(392, (117 + h)) >>>> >>>f.dgv=WinForms.DataGridView() >>>> >>>f.dgv.Location = Point(2, 2) >>>> >>>button = WinForms.Button() >>>> >>>button.Location = Point(256, 64) >>>> >>>button.Text = "Click Me!" >>>> >>>f.Controls.Add(button) >>>> >>>f.Controls.Add(f.dgv) >>>> >>> WinForms.Application.Run(f) > > # import Config class from Nini.dll assembly > >>>> >>>import Nini.Config as config >>>> >>>config= Config.XmlConfigSource("DbManager.xml") >>>> >>>print config.Configs["firebird2.0"].Get("providerName") > FirebirdSql.Data.FirebirdClient > > # import class FirebirdMetaData from Mono.Data.SqlSharp.DatabaseBrowser.dll > >>>> >>>from Mono.Data.SqlSharp.DatabaseBrowser import FirebirdMetaData >>>> >>>me=FirebirdMetaData() >>>> >>>print me > Mono.Data.SqlSharp.DatabaseBrowser.FirebirdMetaData >>>> >>>me.ToString() > Mono.Data.SqlSharp.DatabaseBrowser.FirebirdMetaData > > > > 2. yes the old CLR still works > > from CLR.System.Reflection import Assembly > print Assembly > > > for samples checkout > http://pythonnet.svn.sourceforge.net/viewvc/pythonnet/trunk/pythonnet/demo/ > > > > angel ignacio > > 2007/3/2, Jim Hargrave >: >> I installed the Python.Net for 2.0 (pre-compiles binaries) from the link >> below. But I am unable to get this working: >> >>>>> >>> import clr # this works >>>>> >>> clr.AddReference("System.Windows.Forms") >> Traceback (most recent call last): >> File "", line 1, in ? >> AttributeError: AddReference >> >> According to the readme file this is supposed to work and matches up >> with the IronPython syntax. Am I doing something wrong? >> >> I copied the Python.Net for 2.0 binaries over my Python 2.4 install >> (overwriting my python.exe). >> >> All sample Python.NET files worked fine - but they use the old "CLR" syntax. >> >> Jim >> >> >> angel ignacio colmenares laguado wrote: >>> > 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 >>> > >>> > >>> > ------------------------------------------------------------------------ >>> > >>> > _________________________________________________ >>> > Python.NET mailing list - PythonDotNet at python.org >>> > http://mail.python.org/mailman/listinfo/pythondotnet >> >> _________________________________________________ >> Python.NET mailing list - PythonDotNet at python.org >> http://mail.python.org/mailman/listinfo/pythondotnet > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/pythondotnet/attachments/20070302/ac667c90/attachment-0001.htm From jhargraveiii at comcast.net Sat Mar 3 05:37:12 2007 From: jhargraveiii at comcast.net (Jim Hargrave) Date: Fri, 02 Mar 2007 21:37:12 -0700 Subject: [Python.NET] Using Third Party C# Libraries In-Reply-To: References: <3f37f8c90703020730r54be2e66i56942a56d41ce770@mail.gmail.com> Message-ID: No worries. Python.NET is a remarkable solution - it's well worth a small inconvenience to be able to use it. Jim Brian Lloyd wrote: > Sorry about that ? someone had asked for info on using generics so I put up > in-progress documentation for the next rev and haven?t had time to work on > making some of the stuff true yet :( > > I?ll try to at least get the docs to a sane state to avoid confusion > over the weekend. > > -Brian > > > On 3/2/07 10:30 AM, "angel ignacio colmenares laguado" > wrote: > > 1. yes, you are rigth , clr.AddReference does not work ( there is > not method AddReference in clr.dll nor PythonRuntime.dll). > > But you cant do this: > > > >>import clr > > >>import System.Windows.Forms as WinForms > > >>from System.Drawing import Size, Point > > >>f=WinForms.Form() > > >>f.Text = "Hello World From Python" > > >>f.AutoScaleBaseSize = Size(5, 13) > > >> f.ClientSize = Size(392, 117) > > >>h = WinForms.SystemInformation.CaptionHeight > > >>f.MinimumSize = Size(392, (117 + h)) > > >>f.dgv=WinForms.DataGridView() > > >>f.dgv.Location = Point(2, 2) > > >>button = WinForms.Button() > > >>button.Location = Point(256, 64) > > >>button.Text = "Click Me!" > > >>f.Controls.Add(button) > > >>f.Controls.Add(f.dgv) > > >> WinForms.Application.Run(f) > > # import Config class from Nini.dll assembly > > > >>import Nini.Config as config > > >>config= Config.XmlConfigSource("DbManager.xml") > > >>print config.Configs["firebird2.0"].Get("providerName") > FirebirdSql.Data.FirebirdClient > > # import class FirebirdMetaData from > Mono.Data.SqlSharp.DatabaseBrowser.dll > > > >>from Mono.Data.SqlSharp.DatabaseBrowser import FirebirdMetaData > > >>me=FirebirdMetaData() > > >>print me > Mono.Data.SqlSharp.DatabaseBrowser.FirebirdMetaData > > >>me.ToString() > Mono.Data.SqlSharp.DatabaseBrowser.FirebirdMetaData > > > > 2. yes the old CLR still works > > from CLR.System.Reflection import Assembly > print Assembly > > > for samples checkout > http://pythonnet.svn.sourceforge.net/viewvc/pythonnet/trunk/pythonnet/demo/ > > > > angel ignacio > > 2007/3/2, Jim Hargrave > >: > > I installed the Python.Net for 2.0 (pre-compiles binaries) from > the link > below. But I am unable to get this working: > > >>> import clr # this works > >>> clr.AddReference("System.Windows.Forms") > Traceback (most recent call last): > File "", line 1, in ? > AttributeError: AddReference > > According to the readme file this is supposed to work and matches up > with the IronPython syntax. Am I doing something wrong? > > I copied the Python.Net for 2.0 binaries over my Python 2.4 install > (overwriting my python.exe). > > All sample Python.NET files worked fine - but they use the old > "CLR" syntax. > > Jim > > > angel ignacio colmenares laguado wrote: > > 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 > > > > > > > ------------------------------------------------------------------------ > > > > _________________________________________________ > > Python.NET mailing list - > PythonDotNet at python.org > > http://mail.python.org/mailman/listinfo/pythondotnet > > _________________________________________________ > Python.NET mailing list - > PythonDotNet at python.org > http://mail.python.org/mailman/listinfo/pythondotnet > > > > > > ------------------------------------------------------------------------ > > _________________________________________________ > Python.NET mailing list - PythonDotNet at python.org > http://mail.python.org/mailman/listinfo/pythondotnet From seshagiri.cherukuri at gmail.com Sun Mar 4 10:37:52 2007 From: seshagiri.cherukuri at gmail.com (Seshagiri Cherukuri) Date: Sun, 4 Mar 2007 01:37:52 -0800 Subject: [Python.NET] RunString does not work Message-ID: <8d12fba0703040137s728f6848vb061a602472c9490@mail.gmail.com> hi All, I have embedded pythonnet into my C# application and this works great as far as creating .net objects from python, executing methods etc. Here I am using the RunSimpleString (the PyRun_SimpleString) wrapper to send commands from the C# application to the pythonnet. However I am facing the following problems: 1. After RunSimpleString, PyErr_Occurred or PyErr_Fetch are not able to detect any exceptions even if they did occur - for example, consider the code - curErr = PythonEngine.RunSimpleString( "10/0\n"); - this code does return a -1 value indicating error. - however after this none of PyErr_Occurred or PyErr_Fetch do not detect this error - from python documentation it looks like there is no way to obtain the exception information 2. using RunString - because of above problem I want to send a multi-line code including a try-except: block - I have tried using RunString with all the three modes - Py_eval_input, Py_single_input and Py_file_input - The RunString works only if the code does not have any .net objects or does not include any .net exceptions - If the code sent to RunString includes a .net object e.g. obj, then RunString always returns in NameError, obj is not defined 3. Strangely, if I run the console application, it is able to work with .net exceptions - both .net and user defined exceptions 4. Is this because of the new dictionary created while in RunString? thanks Sesh Cherukuri -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/pythondotnet/attachments/20070304/b1b255fc/attachment.htm From jvm_cop at spamcop.net Sun Mar 4 18:13:37 2007 From: jvm_cop at spamcop.net (J. Merrill) Date: Sun, 04 Mar 2007 12:13:37 -0500 Subject: [Python.NET] RunString does not work In-Reply-To: <8d12fba0703040137s728f6848vb061a602472c9490@mail.gmail.com > References: <8d12fba0703040137s728f6848vb061a602472c9490@mail.gmail.com> Message-ID: <7.0.1.0.2.20070304120033.072e68e8@wheresmymailserver.com> Without any specific reference to Python.Net or C#, my experience has been that cross-process or cross-language calling is made easier by defining a routine on the receiving side that accepts parameters of a string to be run and an indication of whether a return value is desired. The called routine sets up its own try/except block, and runs the string. The return value is a tuple of two values: a boolean indicating whether an error occurred and data. If the boolean indicates failure, the data is the error message as a string or, if you want, a more complex value with error message and execution state information. If the boolean indicates success, the data is the result of running the string if requested or an empty value. (Avoiding sending a potentially large value back as a result is an optimization in the case where the caller doesn't need it.) When you do this, you can use all the power of the called environment to do error-handling in a routine that's written once and re-used. Good luck. At 04:37 AM 3/4/2007, Seshagiri Cherukuri wrote >hi All, > >I have embedded pythonnet into my C# application and this works great as far as creating .net objects from python, executing methods etc. >Here I am using the RunSimpleString (the PyRun_SimpleString) wrapper to send commands from the C# application to the pythonnet. > >However I am facing the following problems: > >1. After RunSimpleString, PyErr_Occurred or PyErr_Fetch are not able to detect any exceptions even if they did occur >- for example, consider the code - curErr = PythonEngine.RunSimpleString("10/0\n" ); >- this code does return a -1 value indicating error. >- however after this none of PyErr_Occurred or PyErr_Fetch do not detect this error >- from python documentation it looks like there is no way to obtain the exception information > >2. using RunString >- because of above problem I want to send a multi-line code including a try-except: block >- I have tried using RunString with all the three modes - Py_eval_input, Py_single_input and Py_file_input >- The RunString works only if the code does not have any .net objects or does not include any .net exceptions >- If the code sent to RunString includes a .net object e.g. obj, then RunString always returns in NameError, obj is not defined > >3. Strangely, if I run the console application, it is able to work with .net exceptions - both .net and user defined exceptions > >4. Is this because of the new dictionary created while in RunString? > >thanks > >Sesh Cherukuri J. Merrill / Analytical Software Corp -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/pythondotnet/attachments/20070304/857c4ba7/attachment.htm From andy.bu at kodak.com Mon Mar 5 01:17:40 2007 From: andy.bu at kodak.com (andy.bu at kodak.com) Date: Mon, 5 Mar 2007 08:17:40 +0800 Subject: [Python.NET] unsubscribe In-Reply-To: Message-ID: Best Regards, ============================== Kodak Health Group Global R&D Center (Shanghai) No. 27 Xin Jinqiao Road Building 4 Jinqiao Software Park, Shanghai, P.R.China 201206 Tel :8621-50308810-5374 Mail : Andy.bu at Kodak.com Building 4, Jinqiao Software Park, Shanghai 201206 ============================== pythondotnet-request at python.org Sent by: pythondotnet-bounces at python.org 03/04/2007 07:00 PM Please respond to pythondotnet at python.org To pythondotnet at python.org cc Subject PythonDotNet Digest, Vol 41, Issue 4 Send PythonDotNet mailing list submissions to pythondotnet at python.org To subscribe or unsubscribe via the World Wide Web, visit http://mail.python.org/mailman/listinfo/pythondotnet or, via email, send a message with subject or body 'help' to pythondotnet-request at python.org You can reach the person managing the list at pythondotnet-owner at python.org When replying, please edit your Subject line so it is more specific than "Re: Contents of PythonDotNet digest..." Today's Topics: 1. RunString does not work (Seshagiri Cherukuri) ---------------------------------------------------------------------- Message: 1 Date: Sun, 4 Mar 2007 01:37:52 -0800 From: "Seshagiri Cherukuri" Subject: [Python.NET] RunString does not work To: pythondotnet at python.org Message-ID: <8d12fba0703040137s728f6848vb061a602472c9490 at mail.gmail.com> Content-Type: text/plain; charset="iso-8859-1" hi All, I have embedded pythonnet into my C# application and this works great as far as creating .net objects from python, executing methods etc. Here I am using the RunSimpleString (the PyRun_SimpleString) wrapper to send commands from the C# application to the pythonnet. However I am facing the following problems: 1. After RunSimpleString, PyErr_Occurred or PyErr_Fetch are not able to detect any exceptions even if they did occur - for example, consider the code - curErr = PythonEngine.RunSimpleString( "10/0\n"); - this code does return a -1 value indicating error. - however after this none of PyErr_Occurred or PyErr_Fetch do not detect this error - from python documentation it looks like there is no way to obtain the exception information 2. using RunString - because of above problem I want to send a multi-line code including a try-except: block - I have tried using RunString with all the three modes - Py_eval_input, Py_single_input and Py_file_input - The RunString works only if the code does not have any .net objects or does not include any .net exceptions - If the code sent to RunString includes a .net object e.g. obj, then RunString always returns in NameError, obj is not defined 3. Strangely, if I run the console application, it is able to work with .net exceptions - both .net and user defined exceptions 4. Is this because of the new dictionary created while in RunString? thanks Sesh Cherukuri -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/pythondotnet/attachments/20070304/b1b255fc/attachment-0001.htm ------------------------------ _______________________________________________ PythonDotNet mailing list PythonDotNet at python.org http://mail.python.org/mailman/listinfo/pythondotnet End of PythonDotNet Digest, Vol 41, Issue 4 ******************************************* -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/pythondotnet/attachments/20070305/574f99aa/attachment.html From brian.lloyd at revolution.com Mon Mar 5 17:34:35 2007 From: brian.lloyd at revolution.com (Brian Lloyd) Date: Mon, 05 Mar 2007 11:34:35 -0500 Subject: [Python.NET] RunString does not work In-Reply-To: <8d12fba0703040137s728f6848vb061a602472c9490@mail.gmail.com> Message-ID: FYI, if you are getting a NameError using RunString that usually means that the string you run needs to do some imports ? remember that RunString creates (essentially) a totally new global local namespace, so you?ll need to import any names you need in your code snippet. e.g. CLR.Food.SpamAndEggs.cook() ...will fail but import CLR import CLR.Food CLR.Food.SpamAndEggs.cook() ...should work hope this helps, -Brian On 3/4/07 4:37 AM, "Seshagiri Cherukuri" wrote: > hi All, > > I have embedded pythonnet into my C# application and this works great as far > as creating .net objects from python, executing methods etc. > Here I am using the RunSimpleString (the PyRun_SimpleString) wrapper to send > commands from the C# application to the pythonnet. > > However I am facing the following problems: > > 1. After RunSimpleString, PyErr_Occurred or PyErr_Fetch are not able to detect > any exceptions even if they did occur > - for example, consider the code - curErr = > PythonEngine.RunSimpleString("10/0\n" ); > - this code does return a -1 value indicating error. > - however after this none of PyErr_Occurred or PyErr_Fetch do not detect this > error > - from python documentation it looks like there is no way to obtain the > exception information > > 2. using RunString > - because of above problem I want to send a multi-line code including a > try-except: block > - I have tried using RunString with all the three modes - Py_eval_input, > Py_single_input and Py_file_input > - The RunString works only if the code does not have any .net objects or does > not include any .net exceptions > - If the code sent to RunString includes a .net object e.g. obj, then > RunString always returns in NameError, obj is not defined > > 3. Strangely, if I run the console application, it is able to work with .net > exceptions - both .net and user defined exceptions > > 4. Is this because of the new dictionary created while in RunString? > > thanks > > Sesh Cherukuri > > > _________________________________________________ > Python.NET mailing list - PythonDotNet at python.org > http://mail.python.org/mailman/listinfo/pythondotnet -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/pythondotnet/attachments/20070305/a5a087b0/attachment.html From seshagiri.cherukuri at gmail.com Mon Mar 5 19:41:58 2007 From: seshagiri.cherukuri at gmail.com (Seshagiri Cherukuri) Date: Mon, 5 Mar 2007 10:41:58 -0800 Subject: [Python.NET] RunString does not work In-Reply-To: References: <8d12fba0703040137s728f6848vb061a602472c9490@mail.gmail.com> Message-ID: <8d12fba0703051041v3c68ed4aybfc9dbe0af7114d6@mail.gmail.com> thanks for your reply. I had the necessary imports in place but was still seeing the error. The following code from Michael Eddington resolved the issue (I think the current problem is because of the dictionary being used) public static PyObject RunString(string code) { PyObject module = ImportModule("__main__"); PyDict globals = new PyDict(Runtime.PyModule_GetDict( module.Handle)); if (locals == null) { locals = new PyDict(Runtime.PyDict_New()); } Runtime.Incref(globals.Handle); Runtime.Incref(locals.Handle); IntPtr result = Runtime.PyRun_String(code, (IntPtr)257, globals.Handle, locals.Handle); if (result == IntPtr.Zero) { return null; } return new PyObject(result); } rgd Sesh On 3/5/07, Brian Lloyd wrote: > > FYI, if you are getting a NameError using RunString that usually means > that the string > you run needs to do some imports ? remember that RunString creates > (essentially) a > totally new global local namespace, so you'll need to import any names you > need in > your code snippet. > > e.g. > > CLR.Food.SpamAndEggs.cook() > > ...will fail > > but > > import CLR > import CLR.Food > CLR.Food.SpamAndEggs.cook() > > ...should work > > > hope this helps, > > -Brian > > > On 3/4/07 4:37 AM, "Seshagiri Cherukuri" > wrote: > > hi All, > > I have embedded pythonnet into my C# application and this works great as > far as creating .net objects from python, executing methods etc. > Here I am using the RunSimpleString (the PyRun_SimpleString) wrapper to > send commands from the C# application to the pythonnet. > > However I am facing the following problems: > > 1. After RunSimpleString, PyErr_Occurred or PyErr_Fetch are not able to > detect any exceptions even if they did occur > - for example, consider the code - curErr = PythonEngine.RunSimpleString( > "10/0\n" ); > - this code does return a -1 value indicating error. > - however after this none of PyErr_Occurred or PyErr_Fetch do not detect > this error > - from python documentation it looks like there is no way to obtain the > exception information > > 2. using RunString > - because of above problem I want to send a multi-line code including a > try-except: block > - I have tried using RunString with all the three modes - Py_eval_input, > Py_single_input and Py_file_input > - The RunString works only if the code does not have any .net objects or > does not include any .net exceptions > - If the code sent to RunString includes a .net object e.g. obj, then > RunString always returns in NameError, obj is not defined > > 3. Strangely, if I run the console application, it is able to work with > .net exceptions - both .net and user defined exceptions > > 4. Is this because of the new dictionary created while in RunString? > > thanks > > Sesh Cherukuri > > ------------------------------ > _________________________________________________ > Python.NET mailing list - PythonDotNet at python.org > http://mail.python.org/mailman/listinfo/pythondotnet > > > -- Seshagiri Rao Cherukuri -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/pythondotnet/attachments/20070305/d82c0d72/attachment.html From ps at pschwalm.de Wed Mar 7 21:00:36 2007 From: ps at pschwalm.de (Peter Schwalm) Date: Wed, 07 Mar 2007 21:00:36 +0100 Subject: [Python.NET] Problem with DateTimePicker control Message-ID: <45EF19E4.2080205@pschwalm.de> Hi, I have problems setting the Value of a DateTimePicker control of Windows Forms. The Value property *is* set (I can print it), but if displayed only the current date is shown in the control, not the value I have set the Value property set to before. The python version is 2.3, the .net versions tested are 1.1 and 2.0. Here are some code snippets: #----------------------------------------------------------------------- def dt2SysDt(dtFrom, incr = 0): #----------------------------------------------------------------------- "python date/dateTime in .net-DateTime(Date) umwandeln" return (System.DateTime(dtFrom.year, dtFrom.month, dtFrom.day) .AddDays(incr)) #----------------------------------------------------------------------- def sysDt2Dt(dtFrom, incr = 0): #----------------------------------------------------------------------- ".net-DateTime(Date) in python dateTime.date umwandeln" dtFrom = dtFrom.AddDays(incr) rv = datetime.date(dtFrom.Year, dtFrom.Month, dtFrom.Day) #print "sysDt2Dt=", rv return rv .... # set the value self.dtpErzeugtVon.Value = dt2SysDt(src.dtErzeugtAb) # display the values of dtp's for ctl in (self.dtpErzeugtVon, self.dtpErzeugtBis, self.dtpVersendetVon, self.dtpVersendetBis): print "dtp...=", ctl.Name, ctl.Value, sysDt2Dt(ctl.Value) # the print statement shows the following ... dtp...= dtpErzeugtBis 31.03.2007 00:00:00 2007-03-31 ... When the form is shown with ShowDialog(), only the current date is show (march 7 instead of march 31). Does anyone have an idea? Thanks Peter Schwalm From andyrsmith at googlemail.com Fri Mar 9 16:29:10 2007 From: andyrsmith at googlemail.com (Andy Smith) Date: Fri, 9 Mar 2007 15:29:10 +0000 Subject: [Python.NET] Simple newbie constructor problem :-( In-Reply-To: <8838bf100703090727u6597ea93yf0db638ee50740ba@mail.gmail.com> References: <8838bf100703090727u6597ea93yf0db638ee50740ba@mail.gmail.com> Message-ID: <8838bf100703090729t2d93c06au3bd2654c542a811d@mail.gmail.com> Hi There, Just getting started - absolute (as of today) newbee.. Seem to be able to load my own assemblies but seem to get stuck passing arguments to my own objects' constructors. Example below................. (using the sourceforge build, have 'added' python .net to the Enthon 2.3 distribution). Code below is being run as-is but the astute will have figured out I don't work for ACME. :-) Have seen similar bugs mentioned in the mailing list but I'd have thought I had to be doing something very wrong for a constructor taking a System.String to be failing :-( So far I've tried calling the Constructor with an unwrapped python string, a System.String, and the constructor taking a String, Uri pair. ( In the hope this would resolve to a specific constructor - no joy! :-( ). Any help appreciated. Cheers, A. ======================================= import sys sys.path.insert( 0, "c:/home/dev/MarketSampler.root/MarketSampler/MarketSampler/MarketSampler/bin/Debug" ) import CLR from CLR.System.Reflection import Assembly from CLR.System import String from CLR.System import Environment as Environment from CLR.System import Uri as Uri a = Assembly.LoadWithPartialName("IntradayPortfolioBuilder") a = Assembly.LoadWithPartialName("MarketSampler") a = Assembly.LoadWithPartialName("ObjectRestorer") a = Assembly.LoadWithPartialName ("Scheduler") import CLR.ACME.IntradayPortfolioBuilder.Exchange as Exchange from CLR.ACME.ObjectRestorer import XmlObjectRestorer as XmlObjectRestorer import CLR.MarketSampler.IntradayBacktesting as IntradayBacktesting import CLR.ACME.Scheduler as Scheduler #IntradayBacktesting.MultiInstrumentTrader() c = Scheduler.Choreographer() XmlObjectRestorer( String("c:/temp/jobs.txt") ) ==================================================== Traceback is .... Python 2.3.5 - Enthought Edition 0.9.9 (#62, Sep 14 2006, 19:20:46) [MSC v.1200 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> ## working on region in file c:/DOCUME~1/andys/LOCALS~1/Temp/python- 3752fom.py... Traceback (most recent call last): File "", line 1, in ? File "c:/DOCUME~1/andys/LOCALS~1/Temp/python- 3752fom.py", line 23, in ? XmlObjectRestorer( String("c:/temp/jobs.txt") ) TypeError: no constructor matches given arguments >>> print XmlObjectRestorer.__doc__ Void .ctor(System.IO.TextReader ) Void .ctor(System.IO.TextReader, System.Uri) Void .ctor(System.String) Void .ctor(System.String, System.Uri) -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/pythondotnet/attachments/20070309/8cd892ef/attachment.html From brian.d.lloyd at gmail.com Fri Mar 9 19:35:18 2007 From: brian.d.lloyd at gmail.com (Brian Lloyd) Date: Fri, 9 Mar 2007 13:35:18 -0500 Subject: [Python.NET] Simple newbie constructor problem :-( In-Reply-To: <8838bf100703090729t2d93c06au3bd2654c542a811d@mail.gmail.com> References: <8838bf100703090727u6597ea93yf0db638ee50740ba@mail.gmail.com> <8838bf100703090729t2d93c06au3bd2654c542a811d@mail.gmail.com> Message-ID: <1c0b4a390703091035o75448cc9j9711f5b91492f1d1@mail.gmail.com> Hi Andy - this often means that an exception was thrown in the constructor (the construction code needs some work and can give the wrong message in this case). At a total guess, I'd say the string you pass to the XmlObjectRestorer probably wants to be an actual xml string rather than a filename... -Brian On 3/9/07, Andy Smith wrote: > > Hi There, > > Just getting started - absolute (as of today) newbee.. > > Seem to be able to load my own assemblies but seem to get stuck passing > arguments to my own objects' constructors. > > Example below................. (using the sourceforge build, have 'added' > python .net to the Enthon 2.3 distribution). > > Code below is being run as-is but the astute will have figured out I don't > work for ACME. :-) Have seen similar bugs mentioned in the mailing list but > I'd have thought I had to be doing something very wrong for a constructor > taking a System.String to be failing :-( > > So far I've tried calling the Constructor with an unwrapped python string, > a System.String, and the constructor taking a String, Uri pair. ( In the > hope this would resolve to a specific constructor - no joy! :-( ). > > Any help appreciated. > > Cheers, > > A. > > > ======================================= > > > import sys > > sys.path.insert( 0, > "c:/home/dev/MarketSampler.root/MarketSampler/MarketSampler/MarketSampler/bin/Debug" > ) > > import CLR > from CLR.System.Reflection import Assembly > from CLR.System import String > from CLR.System import Environment as Environment > from CLR.System import Uri as Uri > > a = Assembly.LoadWithPartialName("IntradayPortfolioBuilder") > a = Assembly.LoadWithPartialName("MarketSampler") > a = Assembly.LoadWithPartialName("ObjectRestorer") > a = Assembly.LoadWithPartialName ("Scheduler") > > import CLR.ACME.IntradayPortfolioBuilder.Exchange as Exchange > from CLR.ACME.ObjectRestorer import XmlObjectRestorer as XmlObjectRestorer > import CLR.MarketSampler.IntradayBacktesting as IntradayBacktesting > import CLR.ACME.Scheduler as Scheduler > > #IntradayBacktesting.MultiInstrumentTrader() > c = Scheduler.Choreographer() > XmlObjectRestorer( String("c:/temp/jobs.txt") ) > > > > ==================================================== > > Traceback is .... > > Python 2.3.5 - Enthought Edition 0.9.9 (#62, Sep 14 2006, 19:20:46) [MSC > v.1200 32 bit (Intel)] on win32 > Type "help", "copyright", "credits" or "license" for more information. > >>> ## working on region in file c:/DOCUME~1/andys/LOCALS~1/Temp/python- > 3752fom.py... > Traceback (most recent call last): > File "", line 1, in ? > File "c:/DOCUME~1/andys/LOCALS~1/Temp/python- 3752fom.py", line 23, in ? > XmlObjectRestorer( String("c:/temp/jobs.txt") ) > TypeError: no constructor matches given arguments > >>> print XmlObjectRestorer.__doc__ > Void .ctor(System.IO.TextReader ) > Void .ctor(System.IO.TextReader, System.Uri) > Void .ctor(System.String) > Void .ctor(System.String, System.Uri) > > > > > _________________________________________________ > Python.NET mailing list - PythonDotNet at python.org > http://mail.python.org/mailman/listinfo/pythondotnet > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/pythondotnet/attachments/20070309/d76e7b0e/attachment.html From andyrsmith at googlemail.com Fri Mar 9 20:16:38 2007 From: andyrsmith at googlemail.com (Andy Smith) Date: Fri, 9 Mar 2007 19:16:38 +0000 Subject: [Python.NET] Simple newbie constructor problem :-( In-Reply-To: <1c0b4a390703091035o75448cc9j9711f5b91492f1d1@mail.gmail.com> References: <8838bf100703090727u6597ea93yf0db638ee50740ba@mail.gmail.com> <8838bf100703090729t2d93c06au3bd2654c542a811d@mail.gmail.com> <1c0b4a390703091035o75448cc9j9711f5b91492f1d1@mail.gmail.com> Message-ID: <8838bf100703091116x3e4bf0fes6505d5bc53e5a8bc@mail.gmail.com> Hi Brian, Thanks for quick response. Think that must have been it. Didn't understand the exception. This was a common garden variety file-naming problem ( the file name I needed has 'xml' extension - not 'txt' ). :-( Thanks again for your help. Cheers, Andy. On 09/03/07, Brian Lloyd wrote: > > Hi Andy - this often means that an exception was thrown in the constructor > (the construction code needs some work and can give the wrong message in > this case). > > At a total guess, I'd say the string you pass to the XmlObjectRestorer > probably wants > to be an actual xml string rather than a filename... > > -Brian > > On 3/9/07, Andy Smith wrote: > > > Hi There, > > > > Just getting started - absolute (as of today) newbee.. > > > > Seem to be able to load my own assemblies but seem to get stuck passing > > arguments to my own objects' constructors. > > > > Example below................. (using the sourceforge build, have > > 'added' python .net to the Enthon 2.3 distribution). > > > > Code below is being run as-is but the astute will have figured out I > > don't work for ACME. :-) Have seen similar bugs mentioned in the mailing > > list but I'd have thought I had to be doing something very wrong for a > > constructor taking a System.String to be failing :-( > > > > So far I've tried calling the Constructor with an unwrapped python > > string, a System.String, and the constructor taking a String, Uri pair. > > ( In the hope this would resolve to a specific constructor - no joy! :-( ). > > > > Any help appreciated. > > > > Cheers, > > > > A. > > > > > > ======================================= > > > > > > import sys > > > > sys.path.insert( 0, > > "c:/home/dev/MarketSampler.root/MarketSampler/MarketSampler/MarketSampler/bin/Debug" > > ) > > > > import CLR > > from CLR.System.Reflection import Assembly > > from CLR.System import String > > from CLR.System import Environment as Environment > > from CLR.System import Uri as Uri > > > > a = Assembly.LoadWithPartialName("IntradayPortfolioBuilder") > > a = Assembly.LoadWithPartialName("MarketSampler") > > a = Assembly.LoadWithPartialName("ObjectRestorer") > > a = Assembly.LoadWithPartialName ("Scheduler") > > > > import CLR.ACME.IntradayPortfolioBuilder.Exchange as Exchange > > from CLR.ACME.ObjectRestorer import XmlObjectRestorer as > > XmlObjectRestorer > > import CLR.MarketSampler.IntradayBacktesting as IntradayBacktesting > > import CLR.ACME.Scheduler as Scheduler > > > > #IntradayBacktesting.MultiInstrumentTrader() > > c = Scheduler.Choreographer() > > XmlObjectRestorer( String("c:/temp/jobs.txt") ) > > > > > > > > ==================================================== > > > > Traceback is .... > > > > Python 2.3.5 - Enthought Edition 0.9.9 (#62, Sep 14 2006, 19:20:46) [MSC > > v.1200 32 bit (Intel)] on win32 > > Type "help", "copyright", "credits" or "license" for more information. > > >>> ## working on region in file c:/DOCUME~1/andys/LOCALS~1/Temp/python- > > 3752fom.py... > > Traceback (most recent call last): > > File "", line 1, in ? > > File "c:/DOCUME~1/andys/LOCALS~1/Temp/python- 3752fom.py", line 23, in > > ? > > XmlObjectRestorer( String("c:/temp/jobs.txt") ) > > TypeError: no constructor matches given arguments > > >>> print XmlObjectRestorer.__doc__ > > Void .ctor(System.IO.TextReader ) > > Void .ctor(System.IO.TextReader, System.Uri) > > Void .ctor(System.String) > > Void .ctor(System.String, System.Uri) > > > > > > > > > > _________________________________________________ > > Python.NET mailing list - PythonDotNet at python.org > > http://mail.python.org/mailman/listinfo/pythondotnet > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/pythondotnet/attachments/20070309/b855af6f/attachment.htm From andyrsmith at googlemail.com Thu Mar 15 17:37:32 2007 From: andyrsmith at googlemail.com (Andy Smith) Date: Thu, 15 Mar 2007 16:37:32 +0000 Subject: [Python.NET] app.config file equivalent location? Message-ID: <8838bf100703150937p1764be80xe10c9af4dca8d16f@mail.gmail.com> I'm trying to use some third party assemblies that pull their config out of the application config file. In VS.NET land this would be taken care of by the app.config which would create an appropriate appname.exe.config file in the bin directory for the build. In trying to mirror this behaviour I've naively tried adding c:/Python23/python.exe.config in the python build directory since strictly this is the exe that's being run. It's very dubious and doesn't seem to work. Is there a way to programatically tweak this? Cheers, A. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/pythondotnet/attachments/20070315/e7fe8881/attachment.htm