39 lines
1.0 KiB
Plaintext
39 lines
1.0 KiB
Plaintext
From: brunomadv at ciudad.com.ar (Bruno Mattarollo)
|
|
Date: Sun, 11 Apr 1999 04:54:44 GMT
|
|
Subject: by-passing exception [Q]
|
|
Message-ID: <000101be83d7$6a77dc80$6eba0ac8@kuarajy.infosys.com.ar>
|
|
X-UID: 1332
|
|
|
|
Hi All Python Gurus ...
|
|
|
|
Perhaps this is a stupid question, but it's saturday and it's almost 2AM,
|
|
so you may understand my state-of-mind :-)
|
|
|
|
I have a script that has to check a directory for the existence of a file,
|
|
so I do a os.stat(path-to-file) ... But I want to continue processing even
|
|
if this file doesn't exist, so I tryed this:
|
|
|
|
try:
|
|
os.stat(path-to-file)
|
|
except IOError, msg:
|
|
blah blah ....
|
|
|
|
But I get an exception ... and it doesn't go into the except statement...
|
|
Should I be doing a os.listdir(path-to-dir-where-file-resides) and checking
|
|
there?
|
|
|
|
I am a little bit confused ... Perhaps it's time to go to bed or to stop
|
|
drinking beer while working ... :-)
|
|
|
|
TIA
|
|
|
|
/B
|
|
|
|
Bruno Mattarollo <bruno at gaiasur.com.ar>
|
|
... proud to be a PSA member <http://www.python.org/psa>
|
|
|
|
|
|
|
|
|
|
|