pywin32 has different behavior when running from * .exe or * .py

andrei andrei via python-win32 <[email protected]>
Newsgroups gmane.comp.python.windows
Message-ID <[email protected]>
I have a Python project developed by a colleague, in which pywin32  is used to control the application: CANoe from Vector.
When he is running the *.py script from PyCharm (2019.2.5) everything is ok, if he used auto-py-to-exe to convert the python script to *.exe, and then he executes the *.exe everything is ok, in both cases the script is working perfectly fine.
Now the problem is the following: if I'm trying to run the *.py script from PyCharm (2020.1.2) the module pywin32 is throwing an exception:
raise AttributeError("'%s' object has no attribute '%s'" % (repr(self), attr))AttributeError: '<win32com.gen_py.CANoe 11.0 Type Library.ITestEnvironment instance at 0x2039251561776>' object has no attribute 'TestModules'
From what I checked the COM Library has 2 dispinterface: ITestEnvironment and ITestEnvironment2, and only ITestEnvironment2 has the attribute TestModules, and it seems that in my case somehow the script is not considering the correct interface.
If I use auto-py-to-exe to convert the python script to *.exe, and then execute the *.exe, everything works perfectly fine. If he converts the script to *.exe and then I run it on my PC, or I convert locally the script to *.exe and run it on my PC, in both cases the output of the script is the same.
I tried:
- Install the same PyCharm version as he uses- Run the code from Visual Studio 2017- Update pywin32 to latest version (228)
in all the cases the result is the same.

I'm using the same Python version as he uses: Py 3.6.7.
Dose anyone know why pywin32 has different behavior when running from * .exe or * .py, and also why it has different behavior on different PCs ?

Have a nice day,Andrei

_______________________________________________
python-win32 mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-win32
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.