FX31337 / FX-BT-Scripts

:page_facing_up: Useful scripts for backtesting.
MIT License
34 stars 39 forks source link

fix: Fix the error handling code for download #80

Closed lonetwin closed 7 years ago

lonetwin commented 7 years ago

codemill-id-57fd18d2750d29000300cd08 fixes #79

kenorb commented 7 years ago

@lonetwin How correcting variables in print fixing the TimeoutError? Can you explain the main fix, where do you handling the TimeoutError exception?

lonetwin commented 7 years ago

@kenorb TimeoutError is a subclass of IOError:

>>> try:
...     raise TimeoutError(42, "Don't Panic")
... except IOError as e:
...     print ("Error: %s: %s" % (e.errno, e.strerror))
... 
Error: 42: Don't Panic

so the code actually goes into the IOError handling block where it then fails to find the .code and .reason attributes. The fix changes this by using the correct attributes of IOError exceptions.