Simple newbie constructor problem :-(
![](https://secure.gravatar.com/avatar/b0a8944a0f9127a20bb749aed40aa53e.jpg?s=120&d=mm&r=g)
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 "<stdin>", 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)
![](https://secure.gravatar.com/avatar/148ae83f207afc94332dae3b87d6c90e.jpg?s=120&d=mm&r=g)
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 <andyrsmith@googlemail.com> 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 "<stdin>", 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@python.org http://mail.python.org/mailman/listinfo/pythondotnet
![](https://secure.gravatar.com/avatar/b0a8944a0f9127a20bb749aed40aa53e.jpg?s=120&d=mm&r=g)
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 <brian.d.lloyd@gmail.com> 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 <andyrsmith@googlemail.com > 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 "<stdin>", 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@python.org http://mail.python.org/mailman/listinfo/pythondotnet
participants (2)
-
Andy Smith
-
Brian Lloyd