Hello everybody,
since this is my first attempt to use python.net I run into a problem. Maybe someone on this list can help or point me into the right direction to solve this issue.
I use a .net assembly in my software which I got from a supplier. While I can successfully load and import the assembly and its classes I get errors when I try to call a function.
The python version is 2.7.3 with the latest python.net clr 4.0.
 
###########################################
Here is my code:
import clr
dll_path = os.path.join(os.getcwd(),"Data","TPS")
if dll_path not in sys.path: sys.path.append(dll_path)
clr.AddReference("isc.Eng.TpsImp")
from isc.Eng.TpsImp import TpsImpEngine
from System import String
tps_securitykey = "..."
result = TpsImpEngine.ServiceStart(String(dll_path), String(tps_securitykey), TpsImpEngine.COILTYP.HeatingWater)

The last command throws an TypeError:
result = TpsImpEngine.ServiceStart(String(dll_path), String(tps_securitykey), TpsImpEngine.COILTYP.HeatingWater)
TypeError: No method matches given arguments
 
###########################################
I tried to get more information on "TpsImpEngine" and "ServiceStart".
print TpsImpEngine.ServiceStart.__doc__
Int32 ServiceStart(System.String, System.String, COILTYP)
 
##########################################
help(TpsImpEngine)
Help on class TpsImpEngine in module isc.Eng.TpsImp:
class TpsImpEngine(System.Object)
 |  Void .ctor()
 |  
 |  Method resolution order:
 |      TpsImpEngine
 |      System.Object
 |      __builtin__.object
 |  
.
.
.
 |  
 |  Overloads
 |  
 |  ServiceEnd
 |      Void ServiceEnd()
 |  
 |  ServiceStart
 |      Int32 ServiceStart(System.String, System.String, COILTYP)
 |  
 |  SystemMessage
 |  
 |  Timeout
 |  
.
.
.
 |  
 |  ----------------------------------------------------------------------
 |  Data and other attributes defined here:
 |  
 |  COILTYP = <class 'isc.Eng.TpsImp.COILTYP'>
 |  
 |  
 |  __new__ = <built-in method __new__ of CLR Metatype object>
 |      T.__new__(S, ...) -> a new object with type S, a subtype of T
 |  
 |  ----------------------------------------------------------------------
 
Strange thing is that if I try to call a function which takes no arguments (e.g. ServiceEnd()) I get the same error. If anybody has an idea on what is going wrong please let me know.
Thank you.
Ingo
 
_________________________________________________
Python.NET mailing list - [email protected]
http://mail.python.org/mailman/listinfo/pythondotnet

Reply via email to