[IronPython] Getting type error when calling a .NET DLL interface.
Max Barry
max at ford-consulting.com
Mon May 4 16:28:07 CEST 2009
Hi all,
I am trying to call an interface from DLL created in .Net to work with a
IronPython script and am getting the following error when I run the
code:
TypeError: Cannot create instances of IDSSCatalog
The trace is below:
Traceback (most recent call last):
File ".\Tutorial\ShiftIntervalMaxValue.py", line 82, in RunApp
Process()
File ".\Tutorial\ShiftIntervalMaxValue.py", line 97, in Process
dictgages = GetCatalogDictFromDSSRS(db,DSS_RS_FILTER)
File ".\Tutorial\ShiftIntervalMaxValue.py", line 176, in
GetCatalogDictFromDSS RS ds = CatalogAsDataSet(db)
File ".\Tutorial\ShiftIntervalMaxValue.py", line 198, in
CatalogAsDataSet dssCatalog = IDSSCatalog(db)
TypeError: Cannot create instances of IDSSCatalog
Below is an example of the code that created the error:
import clr
def LoadTSMNet():
import string,sys
from os import path
#from System.Reflection import Assembly #Import .Net Assembly
to import DLL
mypath = path.dirname(sys.argv[0])
tsmpath = path.join(mypath,"TimeSeriesMgrNet.dll")
tsmpath = string.replace(tsmpath,'\\','\\\\')
clr.AddReferenceToFileAndPath(tsmpath)
#Assembly.LoadFile(tsmpath)
LoadTSMNet()
clr.AddReferenceByPartialName("TimeSeriesMgrNet")
import TimeSeriesMgrNet
from TimeSeriesMgrNet import IDSSCatalog, DSSDatabase
DSS_DATABASE_PATH = "C:/temp/myfile.dss"
db = DSSDatabase()
db.Name = DSS_DATABASE_PATH
db.Connect(False)
dssCatalog = IDSSCatalog(db)
dssCatalog.MakeNewCatalog('')
ds = dssCatalog.AsDataSet(True,'')
db.Disconnect()
IDSSCatalog is the interface and DSSDatabase implements the interface.
Any ideas on why I am getting this error?
Thanks,
Max
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20090504/56a0d50b/attachment.html>
More information about the Ironpython-users
mailing list