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
- python 3.9 32-bit
- auto-py-to-exe 32-bit