[python-win32] servicemanager could not be loaded

Lee Duncan lee at dximg.com
Sun Jun 2 15:32:19 EDT 2024


Hello Python-win32 mailing list:

I just figured out my problem and wanted to share for anyone else.  On a 
normal install of Python 3.12 using pip to install pywin32 I was getting 
"servicemanager.__file__ could not be loaded " pretty much no matter 
what I did.  The message in event viewer was "RuntimeError: 
servicemanager.__file__ could not be loaded - win32 error code is 193 ".


After adding everything to the System Paths I eventually got an error 
message indicating could not load from "c:\program" on the command line. 
  Which lead to a memory I have of why I always installed python to 
c:\python312 ( or whatever ).  I uninstalled python, reinstalled it to 
the directory without spaces and everything works great.

I don't know if it is PythonService.cpp isn't parsing the space in here:

     Py_Initialize();
     module = PyImport_ImportModule("servicemanager");
     if (!module)
         goto failed;
     f = PyObject_GetAttrString(module, "__file__");
     Py_DECREF(module);
     if (!f)
         goto failed;

or if it's somewhere in the ServiceManger.pyd.  I'm not entirely sure 
how to track down where it's not parsing the space, but this is a good 
work around.

Lee Duncan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.python.org/pipermail/python-win32/attachments/20240602/ab715571/attachment.html>


More information about the python-win32 mailing list