ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> python-Tutor
python-Tutor
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

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved