I am using libcurl to DL a webpage, then i am scanning it for data and doing something with one of the links. However, once in a while the page is different then i except thus i extract bad data and pycurl throws an exception. I tried finding the exception name for pycurl but had no luck.
Is there a way i can get the traceback to execute a function so i can dump the file so i can look at the file input and see were my code went wrong?
sys.excepthook may help you here, where you can set a global exception handler. I am not sure how pycurl exceptions are handled, it being a binding library, but it will probably work to reassign it to a generic function. Something like:
>>> import sys
>>>
>>> def my_global_exception_handler(type, value, traceback):
... print traceback
... sys.exit()
...
>>> sys.excepthook = my_global_exception_handler
>>> raise
<traceback object at 0xb7cfcaa4>
This exception hook function could easily be an instance method that has access to the file that needs dumping.