Q: The getcwd() doesn't return the directory that the source file is located.

Dale Strickland-Clark dale at out-think.NOSPAMco.uk
Sun Oct 29 05:39:16 EST 2000


"Hwanjo Yu" <hwanjoyu at uiuc.edu> wrote:

>Hi,
>
>When I try the getcwd(), it returns the python2.0 root directory.
>How to get the current directory that the source file is located ?
>Thanks
>

Have you looked in sys.argv?

import sys
print sys.argv[0]

This prints the path to the source for me.


--
Dale Strickland-Clark
Out-Think Ltd
Business Technology Consultants





More information about the Python-list mailing list