[Python.NET] Simple newbie constructor problem :-(
Andy Smith
andyrsmith at googlemail.com
Fri Mar 9 16:29:10 CET 2007
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)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/pythondotnet/attachments/20070309/8cd892ef/attachment.html
More information about the PythonDotNet
mailing list