Win32All - Services and current path

J

Jeff Hinrichs

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,007
Latest member
obedient dusk

Latest Threads

Top