Problem with Python on MAC OSX

Discussion in 'Python' started by edadk, Jun 29, 2004.

  1. edadk

    edadk Guest


    I have problem with Python on MAC OSX. The following code documents it

    strib:~ eda$ pwd
    strib:~ eda$ python
    Python 2.3 (#1, Sep 13 2003, 00:49:11)
    [GCC 3.3 20030304 (Apple Computer, Inc. build 1495)] on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    Note I would have expected

    print os.getcwd()

    to print


    Note that

    Of course /home/eda is a symbolic link to /private/home/eda. Is this a
    bug or a feature? Is there a good way to work around it?


    edadk, Jun 29, 2004
    1. Advertisements

  2. I can see the same behaviour here under Linux.

    There is no way to work around that, only using the PWD environment
    variable set by the shell. The standard POSIX function getcwd(), which
    Python's os.getcwd utilizes, returns an absolute path to the current
    directory, that is, without any symlinks in it. The shell, in the
    contrary, keeps track of what symlinked directories you enter, and can
    tell you these.

    But why don't you like the result? The directories pointed to by both
    paths are the same...

    Reinhold Birkenfeld, Jun 29, 2004
    1. Advertisements

  3. edadk

    edadk Guest


    This feature is casuing problem when I use the Scons build. See

    It call external tools to do various thing for instance calling the
    perforce source control commandline tool p4 via spawn. So when Scons
    do something like

    'p4 sync file.c'

    perforce gets confused because it wants to work with


    and not


    I agree in most case this feature is not causing any problems but
    sometimes it does.


    edadk, Jun 29, 2004
  4. So you must resort to using the shell-set $PWD -- the kernel does not
    keep track of your current directory in the terms of links.

    Reinhold Birkenfeld, Jun 29, 2004
  5. It's a normal Unix feature.

    The thing that surprices me is that that your home directory is in
    /home in the first place. The standard location for home directories on
    OSX is /Users.

    Ronald Oussoren, Jun 30, 2004
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.