[python-win32] Running a Windows Python service without pythonservice.exe?
Bill Janssen
janssen at parc.com
Sun May 9 23:08:21 CEST 2010
A few weeks ago, Mark mentioned that there's now a way to run a Windows
service without pythonservice.exe.
I'd like to hear more about that. Right now, I'm stuck with my UpLib
system on Windows. I'd like to be able to install everything in the
UpLib directory, including a private copy of Python and PyWin32. But
then there's no way to tell pythonservice.exe where the modules are, and
so Python services don't start.
I'm thinking the problem is this code in PythonService.cpp:
// Our EXE entry point.
1540
1541 int _tmain(int argc, TCHAR **argv)
1542 {
1543 PyObject *module, *f;
1544 PyThreadState *threadState;
1545 HMODULE hmod;
1546 FARPROC proc;
1547 Py_Initialize();
1548 PyEval_InitThreads();
1549 module = PyImport_ImportModule("servicemanager");
1550 if (!module) goto failed;
I've got the PyWin32 extensions installed in a private site-packages
directory under my stuff, which isn't the same as the Python
site-packages site. I need a way to set PYTHONPATH, or in some other
way initialize the DLL load path and Python sys.path, before running the
pythonservice.exe, don't I? Otherwise, this load of "servicemanager"
will fail (and Py_Initialize() will fail if I don't copy
pythonservice.exe to the same location as python.exe and python26.dll).
Bill
More information about the python-win32
mailing list