homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author swarecki
Recipients swarecki
Date 2009年09月23日.05:55:11
SpamBayes Score 5.8469984e-09
Marked as misclassified No
Message-id <1253685313.69.0.648289112505.issue6975@psf.upfronthosting.co.za>
In-reply-to
Content
Hi
The behavior of os.realpath function on Linux is different from the one 
presented by the system. 
Although the path (pointing to the linked dir) is correct
and is recognized by os.path.exists once it is resolved
by the realpath() it does not exist - at the end of the 
resolved path you will see the additional parent directory name.
you will see
..... /two/two at the end of the path.
Below is the code that shows the issue.
def linkGen():
 import os
 print os.getcwd()
 test = "./test"
 os.system( "rm -rf " + test ) 
 #os.mkdir( test )
 os.makedirs( test + "/one" )
 os.makedirs( test + "/two" )
 os.symlink( "../two", test + "/two/this_dir" )
 os.symlink( "../two/this_dir/this_dir/this_dir/this_dir/", test + 
"/one/that_dir" )
 print test + "/one/that_dir", "EXISTS?", 
 print os.path.exists( test + "/one/that_dir" )
 print os.path.realpath( test + "/one/that_dir" ), "EXISTS?", 
 print os.path.exists( os.path.realpath( test + "/one/that_dir" ) )
 os.system( "ls -l " + test + "/one/that_dir" )
 # the line above will show that system can see the directory just fine
linkGen()
History
Date User Action Args
2009年09月23日 05:55:14swareckisetrecipients: + swarecki
2009年09月23日 05:55:13swareckisetmessageid: <1253685313.69.0.648289112505.issue6975@psf.upfronthosting.co.za>
2009年09月23日 05:55:12swareckilinkissue6975 messages
2009年09月23日 05:55:11swareckicreate

AltStyle によって変換されたページ (->オリジナル) /