On Sat, Aug 18, 2012 at 11:19 AM, kj <no.em...@please.post> wrote: > > Basically, I'm looking for a read-only variable (or variables) > initialized by Python at the start of execution, and from which > the initial working directory may be read or computed. >
This will work for Linux and Mac OS X (and maybe Cygwin, but unlikely for native Windows): try the PWD environment variable. >>> import os >>> os.getcwd() '/Users/swails' >>> os.getenv('PWD') '/Users/swails' >>> os.chdir('..') >>> os.getcwd() '/Users' >>> os.getenv('PWD') '/Users/swails' Of course this environment variable can still be messed with, but there isn't much reason to do so generally (if I'm mistaken here, someone please correct me). Hopefully this is of some help, Jason
-- http://mail.python.org/mailman/listinfo/python-list