I could be wrong, but it seems I'm only getting incomplete stack traces and exception messages when a SystemError
is raised in IronPython. I'm doing this:
try:
with SQLConnection(DATASOURCES[SCHEDULEDB]) as db:
db.execute_sql( command + ' ' + ','.join(block) + ';' )
except Exception, e:
print 'caught an exception'
print "Unexpected error:", sys.exc_info()[0]
print e
raise
finally:
db.close()
engine.close()
However, all I'm seeing is this:
Traceback (most recent call last):
SystemError: The connection has been disabled.
Try:
import traceback
traceback.print_exc()
Instead of printing the exception object directly. In Python, exception objects don't hold onto the stack trace directly—instead they're part of the trio of items in sys.exc_info()
.
You could also do:
import System
...
except System.Exception, e:
and you'll get a normal .NET exception object instead of the Python exception object.