[Tutor] [HELP]how to test properties of a file

Nick Lunt nick at javacat.f2s.com
Tue Apr 5 19:33:32 CEST 2005


Shidai Liu wrote:

>>    
>>
>
>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?
>
>  
>
I havent got access to a windows box unfortunately at the moment. And I 
have no idea about permissions on windows boxes anyway :)
However, did you already have the .csv file open in Excel or some other 
app ? Or is is password protected maybe ?

Sorry not much help.

Nick .


More information about the Tutor mailing list