[Tutor] checking if data files are good, readable, and exist

W W srilyk at gmail.com
Tue Jul 22 18:09:19 CEST 2008

On Tue, Jul 22, 2008 at 10:40 AM, Bryan Fodness <bryan.fodness at gmail.com>

> I would like to check to see if the data files are good, readable, and
> exist.  I have checked to see if they exist, but their is a possibility that
> the data file might be binary, and I would like to have a sys.exit for that
> as well.
> if not os.path.isfile(A_data) or not os.path.isfile(B_data)\
>    or not os.path.isfile(C_data) or not os.path.isfile(D_data):
>     sys.exit(14)

Am I wrong in thinking that /all/ files are stored as binary? And then when
python opens them, it automagically opens them in a more readable format,
unless you open them in binary with "rb" or similar command?


To be considered stupid and to be told so is more painful than being called
gluttonous, mendacious, violent, lascivious, lazy, cowardly: every weakness,
every vice, has found its defenders, its rhetoric, its ennoblement and
exaltation, but stupidity hasn't. - Primo Levi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20080722/e9823176/attachment.htm>

More information about the Tutor mailing list