Testing for exc_traceback? The weirdest thing I've ever seen...

jwsacksteder at ramprecision.com jwsacksteder at ramprecision.com
Mon Jun 16 17:01:26 EDT 2003


I have a data extraction script that is pulling data out of an ODBC
datasource on Win32 using the standard DBI 1.0 ODBC code. When I iterate
over each row and column in turn, I am seeing strange behaviour on some date
fields. This is certainly due the abysmal odbc driver provided by my vendor.
My sad story is that I need to work around these bad records.

If I try the following statement-

	print type(my_row[3]) 
I get- 
	<type 'DbiDate'>

Which is expected.

If I try to
	print str(my_row[3]) 
I get-
	exc_traceback

My workaround would be to check for this condition and return null if this
happens, which I am trying to do like this-

for column_seq in row:
	if str(column_name) == "exc_traceback":
		dest_column = 'null'
	else:
		dest_column = column_seq		

It doesn't work as I would expect it to, so obvoiusly I'm thinking about it
wrong. What is the correct way to test for these values?






More information about the Python-list mailing list