By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,548 Members | 1,497 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,548 IT Pros & Developers. It's quick & easy.

Checking File permissions

P: n/a
Hi All

Please tell me how to check the existence of a file and the read
permission to the file using python script

Thanks for ur inputs

Anoop

Jul 20 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
In message <11*********************@m79g2000cwm.googlegroups. com>, Anoop
wrote:
Please tell me how to check the existence of a file and the read
permission to the file using python script
Without knowing what your precise needs are, the best way is to open the
file and try to read from it. If that succeeds, then you've got read
access.

Checking permissions as a separate step from opening the file exposes your
code to a race condition where the permissions may be OK during the initial
check, but then change to deny access before the subsequent open.
Jul 21 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.