mhammond / pywin32

Python for Windows (pywin32) Extensions
4.89k stars 783 forks source link

Error 1053 starting a Windows Service created from Python script #2056

Open JDM-GBG opened 1 year ago

JDM-GBG commented 1 year ago

Complete information can be found in this StackOverflow article: https://stackoverflow.com/questions/76174279/module-not-found-error-in-python-script-running-as-a-windows-service

Essential details:

Environment was Python 3.11.3 and pywin32 306. (Also mssql-django 4.1.8)

I was using a script based on this template https://www.programming-books.io/essential/python/a-python-script-that-can-be-run-as-a-service-81a02f06a35141a1bc12d24f2f0f6243 ...to set up a Windows Service that would run a Django web server

The service installed normally. However any attempt to run it terminated with Error 1053.

After finding this issue via Google: https://github.com/mhammond/pywin32/issues/1987

...I tried a similar workaround, reverting from Python 3.11.3 to the current 3.10 release (3.10.11). After taking this step, the service started normally.

Based on this I believe there's an incompatibility between pywin32 and Python 3.11 that needs addressed.

FireByTrial commented 1 year ago

same issue here, seemed like the DLL files werent copied to system32 in the python3.11 version, downgraded to 3.10.11 and re-ran post install etc and then installed the file again and worked fine

leolcao commented 7 months ago

I meet this issue, but the root cause is not one of below:

Instead, they bothly work with pywin32 306 version on the windows 10/11 x64 system.

The root cause is because of some local anti-virus and protecting tool from IT demands, those kind tool will manipulate the python files to make the pywin32 dll and exe not work functional.

Just share this info ~