SOLVED: py2exe Registry Access from NT Service ...

Harald Schneider h_schneider at marketmix.com
Fri Apr 18 10:22:27 EDT 2003


Strange ... I changed the order of the import statements from

import win32serviceutil,win32service,win32event,pywintypes
import os,string,rpcserver,xmlrpclib,confighandler
from agent import *
from setuptool import RegistryTool

to

from agent import *
from setuptool import RegistryTool
import win32serviceutil,win32service,win32event,pywintypes
import os,string,rpcserver,xmlrpclib,confighandler

and not it works!

The registry access is done in a class contained in the agent module. Under
Python 2.1 the order played no role, under 2.2 it does!

All the best,
Harald


"Harald Schneider" <h_schneider at marketmix.com> schrieb im Newsbeitrag
news:b7mjlc$6tm$03$1 at news.t-online.com...
> Running the service framework with
>
> if __name__ == '__main__':
>     win32serviceutil.HandleCommandLine(Service)
>
> also works without problem. When I freeze the whole thing, it ceases to
> function ... :-/
>
> --Harald
>
>
> "Harald Schneider" <h_schneider at marketmix.com> schrieb im Newsbeitrag
> news:b7mf9u$2jb$03$1 at news.t-online.com...
> > It's in HKEY_LOCAL_MACHINE.
> >
> > The registry calls are in another module, which is imported. The
registry
> > calls work, when I move them to the Service framework. So this seems to
be
> > an import problem which only happens on 2.2 ...
> >
> > > What happens when you run the service as not-py2exe'd service (via
> > > PythonService.exe)?
> >
> > It just says
> > Could not start the service - error 203
> > Registering the Python Service Manager..
> >
> > Very strange ..
> >
> > --Harald
> >
> >
> >
> > "Thomas Heller" <theller at python.net> schrieb im Newsbeitrag
> > news:8yu9gpnb.fsf at python.net...
> > > "Harald Schneider" <h_schneider at marketmix.com> writes:
> > >
> > > > No permission probs, logged in as Admin. Platform is Win2K, not
> updated
> > from
> > > > NT.
> > > > There are no exceptions. Reading a registry key just claims it would
> not
> > > > exist. When I run the same code outside the service wrapper, I can
> read
> > the
> > > > key.
> > > >
> > >
> > > Strange.
> > >
> > > Do you mean *you* are logged in as Admin, or does the *service* run
> under
> > > the Admin account?
> > >
> > > Per default a service runs under the system account. Maybe the
registry
> > > keys are really not there then? HKEY_CURRENT_USER, probably?
> > >
> > > What happens when you run the service as not-py2exe'd service (via
> > > PythonService.exe)?
> > >
> > > Thomas
> > >
> > > PS: As far as i can tell, there are no differences between the 2.2 and
> 2.1
> > > release of py2exe. Not yet ;-)
> >
> >
>
>






More information about the Python-list mailing list