Getting original working directory

Lawrence D'Oliveiro ldo at geek-central.gen.new_zealand
Fri Sep 7 04:12:35 EDT 2007


In message <mailman.177.1189106051.2658.python-list at python.org>, Steve
Holden wrote:

> Python runs as a sub-process. The parent process (the one that started
> Python) contains the working directory that the Python interpreter
> inherited from it. But you can't expect to just go poking around inside
> the environment of your parent process...

Under Linux:

    os.readlink("/proc/%d/cwd" % os.getppid())



More information about the Python-list mailing list