Win32All - Services and current path

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jeff Hinrichs

    Win32All - Services and current path

    I'm having trouble nailing down the path to the script directory when
    building a service.
    I am trying to read in a config file via ConfigParser. When I run the
    service in debug mode all is well.
    When I start it up normally, via 'myservice.py start' I can't get the
    directory where my service lives.

    When starting the service normally the current path when I try to read the
    file gets set to:
    G:\Python22\lib \site-packages\win32
    probably because that is where pythonservice lives. So I can't use
    sys.path[0] or parse sys.argv[0]
    to find directory where my config file lives. I don't want to hardcode the
    path to the config file but
    currently that is the only way I can get the ConfigParser object to find my
    file.

    What am I missing?


    -Jeff


Working...