stat doesn't work!
Paulo Pinto
paulo.pinto at cern.ch
Tue Feb 10 03:53:15 EST 2004
It works now.
Thanks for your answers.
Paulo Pinto wrote:
> I am doing an application that needs to
> know when it is manipulating symbolic links.
>
> But it is failing to reckognize them.
>
> If I run the following code:
>
> <code>
> import sys
> import os
> from stat import *
>
> mode = os.stat(sys.argv[1])[ST_MODE]
> if S_ISLNK(mode):
> print 'File is a link'
> else:
> print 'Just a normal file'
> </code>
>
>
> I will alway get the 'Just a normal file'
> message even though I am using a symbolic
> link as argument.
>
> I've done the same example in Perl and in
> bash and it works.
>
> Could this be a bug in my Python version
> (2.2.2) or I am doing something wrong ?
>
> Thanks in advance,
> Paulo Pinto
>
More information about the Python-list
mailing list