|
|
|
|
|
|
| Author |
Message |
Anoop *nix forums beginner
Joined: 20 Jul 2006
Posts: 5
|
Posted: Thu Jul 20, 2006 1:19 pm Post subject:
Checking File permissions
|
|
|
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 |
|
| Back to top |
|
 |
Lawrence D'Oliveiro *nix forums Guru
Joined: 25 Mar 2005
Posts: 723
|
Posted: Fri Jul 21, 2006 5:26 am Post subject:
Re: Checking File permissions
|
|
|
In message <1153401557.444000.92210@m79g2000cwm.googlegroups.com>, Anoop
wrote:
| Quote: | 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. |
|
| Back to top |
|
 |
Google
|
|
| Back to top |
|
 |
|
|
The time now is Sun Nov 23, 2008 1:52 pm | All times are GMT
|
|
Loans | WoW Gold | Myspace Layouts | Payday Loan | Xbox Mod Chip
|
|
Copyright © 2004-2005 DeniX Solutions SRL
|
|
|
|
Other DeniX Solutions sites:
Unix/Linux blog |
electronics forum |
medicine forum |
science forum |
|
|
Privacy Policy
|
Powered by phpBB © 2001, 2005 phpBB Group
|
|