I'm trying to update an old python script from Python-2.7 to Python-3.7 (or newer). The script uses IronPython-2.7 to connect to a C# dll for a SDK interaction with the Windows Application. The new code implements the pythonnet libraries to take over the C# interaction.
The 'old' state of the script works and is live tested and verified.
The renewed script in python-3.7 style is failing on the C# connection to the application.
I'm trying to debug the specific failing code by running it first in a Python-2.7 command prompt.
As seen by the return value "True" all is fine in the 2.7 environment.
>>> import clr
>>> import System
>>> sdk = System.Activator.CreateInstance(type=System.Type.GetTypeFromProgID('AppSDK.Application'))
>>> print(sdk)
<System.__ComObject() object at 0x000000000000006C>
>>> sdk.Connect('localhost')
True
>>>
And them the same code is tested in a Python-3.7 terminal. When connecting to the application this code fails on the connection.
>>> import clr
>>> import System
>>> sdk = System.Activator.CreateInstance(type=System.Type.GetTypeFromProgID('AppSDK.Application'))
>>> print(sdk)
System.__ComObject
>>> sdk.Connect('localhost')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: '__ComObject' object has no attribute 'Connect'
Is this a specific pythonnet with Python-3.7 related issue? Or am I calling the connection to the application incorrectly?
BR, LVX