[python-win32] handling paths in windows services

Gabriel Genellina gagenellina at softlab.com.ar
Sat Sep 10 00:22:57 CEST 2005


At Friday 9/9/2005 11:08, you wrote:

>The 'svc.cfg' is on the the same directory that contains the python
>script, but its path is obviously not available to the windows
>service. Short of using absolute paths, what would be the correct way
>to handle this.

Try this:

import os,sys
print os.path.join(
     os.path.dirname(
       os.path.abspath(
         sys.argv[0])),
     'svc.cfg')



Gabriel Genellina
Softlab SRL 



More information about the Python-win32 mailing list