You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was setting up a simple test project to play with python windows services with virtual environment based on this tutorial https://oxylabs.io/blog/python-script-service-guide . While running pywin32_postinstall I got the following error:
RuntimeError: Can not locate the program 'pythonw_d.exe'
It seems that a python debug build was identified even though I used a regular python build. After some digging, I located the issue in the _find_localserver_exe function in the win32com.server.register module. At the beginning of the file, the base .exe is identfied as
def _find_localserver_exe(mustfind):
if not sys.platform.startswith("win32"):
return sys.executable
if pythoncom.__file__.find("_d") < 0:
exeBaseName = "pythonw.exe"
else:
exeBaseName = "pythonw_d.exe"
...
pythoncom.file.find("_d") returns the full path. In my case, the project folder containing the virtual environment is named c:/Code/python_windows_service_demo so the "_d" produced a match. This should be easily fixable by only checking the filename instead of the full path, e.g.
if os.path.basename(pythoncom.__file__).find("_d") < 0:
Python: 3.12.2
PyWin32: 306
Steps to reproduce: Follow the tutorial but place your virtual environment in a dir that has "_d" somewhere in its path.
The text was updated successfully, but these errors were encountered:
I was setting up a simple test project to play with python windows services with virtual environment based on this tutorial https://oxylabs.io/blog/python-script-service-guide . While running pywin32_postinstall I got the following error:
RuntimeError: Can not locate the program 'pythonw_d.exe'
It seems that a python debug build was identified even though I used a regular python build. After some digging, I located the issue in the _find_localserver_exe function in the win32com.server.register module. At the beginning of the file, the base .exe is identfied as
pythoncom.file.find("_d") returns the full path. In my case, the project folder containing the virtual environment is named c:/Code/python_windows_service_demo so the "_d" produced a match. This should be easily fixable by only checking the filename instead of the full path, e.g.
Python: 3.12.2
PyWin32: 306
Steps to reproduce: Follow the tutorial but place your virtual environment in a dir that has "_d" somewhere in its path.
The text was updated successfully, but these errors were encountered: