Is os.lstat available on all platforms?

G

Giampaolo Rodola'

Hi there.
In a code of mine I'd like to use os.lstat whenever possible.
My only concern is if it's available on all platforms.
It could be safe using always os.lstat instead of:

try:
os.lstat
except AttributeError:
os.stat

....?
As far as I know where symlinks are not supported os.lstat should be
an alias for os.stat but I'm not 100% sure.
 
C

Christian Heimes

Giampaolo said:
As far as I know where symlinks are not supported os.lstat should be
an alias for os.stat but I'm not 100% sure.

You are right, it should be an alias. os.lstat is available on Windows, too.

Christian
 
G

Giampaolo Rodola'

I'd just want to be sure that even on a strange python implementation
I won't ever get an AttributeError exception because os.lstat is not
defined.
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,189
Latest member
CryptoTaxSoftware

Latest Threads

Top