vbuterin / pybitcointools

SImple, common-sense Bitcoin-themed Python ECC library
1.3k stars 861 forks source link

Null exception error #41

Open hoffmabc opened 10 years ago

hoffmabc commented 10 years ago

Not sure if this is related to #39 but I am seeing issues intermittently where a null exception is raised.

Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 810, in __bootstrap_inner
    self.run()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 763, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/Users/brianhoffman/Projects/merge/083014/OpenBazaar/node/trust.py", line 103, in get_history
    history = pybitcointools.history(addr)
  File "/Library/Python/2.7/site-packages/pybitcointools/bci.py", line 28, in history
    data = make_request('http://blockchain.info/address/%s?format=json&offset=%s' % (addr,offset))
  File "/Library/Python/2.7/site-packages/pybitcointools/bci.py", line 13, in make_request
    raise Exception(p)
Exception: null
qubez commented 9 years ago

This is because of wonky error handling expecting a reason from urllib2, which may not be returned. There need to be independent handlers for URLError and HTTPError, HTTPError returns no reason. URLError handler should be tolerant of no reason or even a reason filled with exploits and fuzz.

http://bugs.python.org/issue13211