I am trying to catch an exception from the csv module but it doesn't seem to be generating a proper exception because I don't seem to be able to catch it. Here is what I am doing:
for inputline in fileinput.input(args):
try:
input = csv.reader([inputline], escapechar='\\')
except:
print "ERROR", inputline
This is the traceback:
Traceback (most recent call last):
File "/usr/openv/local/bin/bpdbreport_test.py", line 539, in ?
for line in input:
_csv.Error: newline inside string
Shouldn't I be able to catch this? The reason I'm doing it this way is
because I have discovered a ctrl-M in the data I am parsing and the csv
module bombs out on it. I needed to check each line individually. I
thought I could do a try block around the csv.reader line and deal with
the rare exception.
Does anyone know why this try block doesn't catch the exception? The
version of Python I am using is 2.3.3
Thanks.
--
David Rock
[EMAIL PROTECTED]
pgprCjzYhfyU7.pgp
Description: PGP signature
_______________________________________________ Tutor maillist - [email protected] http://mail.python.org/mailman/listinfo/tutor
