problem with linked directory

SungPil Yoon yoonseo at altavista.net
Tue May 7 13:54:19 EDT 2002


Hi, all

Here is the problem that I am dealing with:

I have a directory structure

    /home/userdir/dir1
    /home/userdir/dir2
    /home/userdir/dir3 -> /work/userdir/dir3

The third directory is not a physical directory but a soft link to other
directory. When I am in that directory, the shell command 'pwd' gives the
result that I want:

    /home/userdir/dir3> pwd
    /home/userdir/dir3

But os.getcwd function does not work in the way that I hope:

    >>> import os
    >>> os.getcwd()
    /work/userdir/dir3

Another approach does not work either:

    >>> import os
    >>> os.system("pwd")
    /work/userdir/dir3

How can I obtain what I want using Python?
Any help will be appreciated.

sungpil



More information about the Python-list mailing list