I am trying to get a Flask app to run as a Service in Windows. I have already tried to implement a solution as suggested here and here without success.
I ha
I looked further into pyinstaller github repo and solved this issue.
It seems that pyinstaller has some conflicts with Windows 10, but this issue was the key to my problem. Althoug the module producing the error was not the same.
I managed to solve it by adding a SystemError exception at lib\site-packages\click\utils.py, line 260 in the echo function.
So I change this:
if message:
file.write(message)
To this:
if message:
try:
file.write(message)
except SystemError:
pass
Rebuilt the exe using:
pyinstaller --onefile --hidden-import win32timezone win32_service.py
Installed the service, and then it started correctly.