问题
On all the machines on my cluster, my home directory is mounted from the NFS server as /home/drive1/username. On the NFS server, the folder /home/drive1/username is a symbolic link to /drive1/username.
Running:
$ python -c "import os; os.chdir('/home/drive1/username'); print(os.getcwd())"
on any machine other than the NFS server prints:
/home/drive1/username
but on the NFS server, the same command prints:
/drive1/username
Is there any way to prevent Python os.chdir from walking the symbolic link? This makes it difficult to specify the correct path when submit jobs from the NFS server to the worker nodes.
Edit:
Note that
cd /home/drive1/username
pwd
works as expected on all machines.
来源:https://stackoverflow.com/questions/45336802/prevent-os-chdir-from-resolving-symbolic-link