I'm using the following syntex to create a successful exe that works properly on the development machine (has python installed, the project is using venv)
pyinstaller --noconfirm --onefile --console --paths "C:/Users/Userxx/source/repos/PythonOPCClient/PythonOPCClient/env/Lib/site-packages" --hidden-import "win32timezone" "C:/Users/Userxx/source/repos/PythonOPCClient/PythonOPCClient/PythonOPCClient.py"
The problem comes running the exe on a customer machine (No python), the application throws the following exceptions
Traceback (most recent call last):
File "OpenOPC.py", line 1117, in servers
File "C:\Users\ADMINI~1\AppData\Local\Temp\tmp8l82ug16\gen_py\28E68F91-8D75-11D1-8DC3-3C302A000000x0x1x0.py", line 262, in GetOPCServers
return self._ApplyTypes_(1610743825, 1, (12, 0), ((12, 17),), 'GetOPCServers', None,Node
File "win32com\client\__init__.py", line 572, in _ApplyTypes_
pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, None, 'Invalid value for registry\r\n', None, 0, -2147467259), None)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "PythonOPCClient.py", line 17, in <module>
File "OpenOPC.py", line 1123, in servers
OpenOPC.OPCError: servers: -2147467259
[12352] Failed to execute script 'PythonOPCClient' due to unhandled exception!
using the following
Based on the issue reported, it was suggested that the OPC Core Components may need to be re-installed. However, the attempt to resolve the problem using the OPC Core Components Redistributable (x86) 3.00.108.msi did not yield the desired result.
As a workaround, the Wonderware OI-gateway drive was re-installed on the affected machine, which resulted in the successful functioning of the OPCClient.
While this solution may not be a definitive fix, it is hoped that it may prove helpful to others experiencing similar issues.