os.access() under windows
David Tweet
davidtweet at gmail.com
Sat Dec 1 16:45:03 EST 2007
To answer indirectly, usually the EAFP (easier to ask forgiveness than
permission) approach works better for this kind of thing.
try:
f = open('e:\\test\\test', 'a')
f.write('abc')
f.close()
except IOError:
print "couldn't write test file, continuing..."
On Dec 1, 2007 1:48 AM, Yann Leboulanger <yann.le_boulanger at u-paris10.fr> wrote:
> Hi,
>
> Under Windows XP os.access has a strange behaviour:
>
> I create a folder test under e:
>
> then os.access('e:\\test', os.W_OK) returns True. Everything's ok.
>
> Now I move My Documents to this e:\test folder
>
> Then os.access('e:\\test', os.W_OK) returns False !!
>
> but this works:
> f = open('e:\\test\\test', 'a')
> f.write('abc')
> f.close()
>
> So why os.access returns False ?
>
> --
> Yann
> --
> http://mail.python.org/mailman/listinfo/python-list
>
--
-David
More information about the Python-list
mailing list