On Apr 4, 2005 10:54 PM, Nick Lunt <[EMAIL PROTECTED]> wrote:
> I've gotten into the habit of just using the os.?_OK stuff.
> 
> eg
> 
> >>> import os
> >>> os.access('/', os.W_OK)
> False
> >>> os.access('/tmp', os.W_OK)
> True
> 
> Thats gotta be simple if I understand it lol :)
> 
> Nick .
> 

I found out in the following situation, it fails to work.
Say, 'somefile.csv' is opened by EXCEL,
>>> os.access('somefile.csv', os.W_OK)
True
>>> file('somefile.csv', 'w')
IOError: [Errno 13] Permission denied: 'somefile.csv'

By the way, using os.stat & stat as suggested by Alan doesn't work either.
Any idea how solve it?
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to