[EMAIL PROTECTED] wrote: > > On Oct 24, 7:01 pm, Gabriel Genellina <[EMAIL PROTECTED]> wrote: > >>At Tuesday 24/10/2006 20:39, [EMAIL PROTECTED] wrote: >> >> >>>I have the following python script and some_command in the same >>>directory. I have to call the python script from that directory. >>>Otherwise, some_command won't be found. I'm wondering how to make the >>>following script working no matter what the working directory is.print > > >>os.path.abspath(__file__) > > > How to get the absolute dir name which the file is in? Is there any > function can be called easily? > > Thanks, > Peng >
That would be os.path.split(os.path.abspath(__file__))[0] You *are* planning to read the documentation at some stage, right? ;-) regards Steve -- Steve Holden +44 150 684 7255 +1 800 494 3119 Holden Web LLC/Ltd http://www.holdenweb.com Skype: holdenweb http://holdenweb.blogspot.com Recent Ramblings http://del.icio.us/steve.holden -- http://mail.python.org/mailman/listinfo/python-list