Re: [Tutor] Test for file existance
by Alan Gauld other posts by this author
Aug 30 2004 9:54PM messages near this date
[Tutor] Test for file existance
|
Re: [Tutor] Test for file existance
> os.access("/home/klas/epa.txt", F_OK)
> but i get the following error:
>
> Traceback (most recent call last):
> File "<pyshell#156>", line 1, in ?
> kalle = os.access("/home/klas/epa.txt",F_OK)
> NameError: name 'R_OK' is not defined
That's because F_OK is defined in the os module,
so you need to use os.F_OK
But why not use the much sipler os.path.exists()
function instead?
Alan G.
_______________________________________________
Tutor maillist - Tutor@[...].org
http://mail.python.org/mailman/listinfo/tutor
Thread:
Klas Marteleur
Alan Gauld
Jeff Shannon
|