[Tutor] Test for file existance

Jeff Shannon jeff at ccvcorp.com
Mon Aug 30 21:48:37 CEST 2004


Klas Marteleur wrote:
> I wanna test for file existance using os.access
> I have tried the following but none seem to work
> 
> os.access("/home/klas/epa.txt", F_OK)
> os.access("/home/klas/epa.txt", f_ok)
> os.access("/home/klas/epa.txt", "F_OK")
> os.access("/home/klas/epa.txt", "f_ok")
> 
> but i get the following error:

Have you tried os.path.exists() ?

http://docs.python.org/lib/module-os.path.html

Hope that helps you out. :)

Jeff Shannon
Technician/Programmer
Credit International



More information about the Tutor mailing list