servicemanager could not be loaded

"Lee Duncan" <[email protected]> Sun, 02 Jun 2024 19:32:19 +0000
Newsgroups gmane.comp.python.windows
Message-ID <[email protected]>
--===============3535459757381681968==
Content-Type: multipart/alternative;
 boundary="------=_MBE63F76C9-811E-4610-86FC-D02FB6DF2598"

--------=_MBE63F76C9-811E-4610-86FC-D02FB6DF2598
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: quoted-printable

Hello Python-win32 mailing list:

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


After adding everything to the System Paths I eventually got an error=20
message indicating could not load from "c:\program" on the command line.=20
  Which lead to a memory I have of why I always installed python to=20
c:\python312 ( or whatever ).  I uninstalled python, reinstalled it to=20
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 =3D PyImport_ImportModule("servicemanager");
     if (!module)
         goto failed;
     f =3D 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=20
how to track down where it's not parsing the space, but this is a good=20
work around.

Lee Duncan

--------=_MBE63F76C9-811E-4610-86FC-D02FB6DF2598
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable

<html><head>

<style id=3D"css_styles">=20
blockquote.cite { margin-left: 5px; margin-right: 0px; padding-left: 10px;=
 padding-right:0px; border-left: 1px solid #cccccc }
blockquote.cite2 {margin-left: 5px; margin-right: 0px; padding-left: 10px;=
 padding-right:0px; border-left: 1px solid #cccccc; margin-top: 3px; padding=
-top: 0px; }
a img { border: 0px; }
li[style=3D'text-align: center;'], li[style=3D'text-align: center; '], li[s=
tyle=3D'text-align: right;'], li[style=3D'text-align: right; '] {  list-sty=
le-position: inside;}
body { font-family: 'Segoe UI'; font-size: 12pt; }
.quote { margin-left: 1em; margin-right: 1em; border-left: 5px #ebebeb soli=
d; padding-left: 0.3em; }

 </style>
</head>
<body><div>Hello Python-win32 mailing list:</div><div><br /></div><div>I ju=
st figured out my problem and wanted to share for anyone else.=C2=A0 On a n=
ormal install of Python 3.12 using pip to install pywin32 I was getting "se=
rvicemanager.__file__ could not be loaded " pretty much no matter what I di=
d.=C2=A0 The message in event viewer was "RuntimeError: servicemanager.__fi=
le__ could not be loaded - win32 error code is 193
".</div><div><span>=C2=A0</span></div><div><br /></div><div>After adding ev=
erything to the System Paths I eventually got an error message indicating c=
ould not load from "c:\program" on the command line.=C2=A0 Which lead to a=
 memory I have of why I always installed python to c:\python312 ( or whateve=
r ).=C2=A0 I uninstalled python, reinstalled it to the directory without sp=
aces and everything works great.</div><div><br /></div><div>I don't know if =
it is PythonService.cpp isn't parsing the space in here:</div><div><br /><=
/div><div>=C2=A0 =C2=A0 Py_Initialize();
</div><div>=C2=A0 =C2=A0 module =3D PyImport_ImportModule("servicemanager")=
;
</div><div>=C2=A0 =C2=A0 if (!module)
</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 goto failed;
</div><div>=C2=A0 =C2=A0 f =3D PyObject_GetAttrString(module, "__file__");
</div><div>=C2=A0 =C2=A0 Py_DECREF(module);
</div><div>=C2=A0 =C2=A0 if (!f)
</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 goto failed;</div><div><br /></div><=
div>or if it's somewhere in the ServiceManger.pyd.=C2=A0 I'm not entirely s=
ure how to track down where it's not parsing the space, but this is a good=
 work around.</div>
<div><br /></div><div id=3D"signature_old" style=3D"clear:both"><div>Lee Du=
ncan</div></div><div><br /></div>
</body></html>
--------=_MBE63F76C9-811E-4610-86FC-D02FB6DF2598--


--===============3535459757381681968==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
python-win32 mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-win32

--===============3535459757381681968==--