MikaLendingBot icon indicating copy to clipboard operation
MikaLendingBot copied to clipboard

Error local variable 'ex' referenced before assignment

Open easye35 opened this issue 4 years ago • 4 comments

Keep getting this error on the log

Traceback (most recent call last): poloniex_1 | File "/usr/src/app/lendingbot.py", line 97, in poloniex_1 | Lending.transfer_balances() poloniex_1 | File "/usr/src/app/modules/Lending.py", line 454, in transfer_balances poloniex_1 | exchange_balances = api.return_balances() # This grabs only exchange balances. poloniex_1 | File "/usr/src/app/modules/Poloniex.py", line 169, in return_balances poloniex_1 | return self.api_query('returnBalances') poloniex_1 | File "/usr/src/app/modules/ExchangeApi.py", line 29, in new_method poloniex_1 | return method(self, *arg, **kws) poloniex_1 | File "/usr/src/app/modules/Poloniex.py", line 141, in api_query poloniex_1 | ex.message = ex.message if hasattr(ex, 'message') and ex.message else str(ex) poloniex_1 | UnboundLocalError: local variable 'ex' referenced before assignment poloniex_1 | poloniex_1 | Unhandled error, please open a Github issue so we can fix it!

easye35 avatar May 09 '21 15:05 easye35

Traceback (most recent call last): tindolt_1 | File "lendingbot.py", line 97, in tindolt_1 | Lending.transfer_balances() tindolt_1 | File "/usr/src/app/modules/Lending.py", line 454, in transfer_balances tindolt_1 | exchange_balances = api.return_balances() # This grabs only exchange balances. tindolt_1 | File "/usr/src/app/modules/Poloniex.py", line 169, in return_balances tindolt_1 | return self.api_query('returnBalances') tindolt_1 | File "/usr/src/app/modules/ExchangeApi.py", line 29, in new_method tindolt_1 | return method(self, *arg, **kws) tindolt_1 | File "/usr/src/app/modules/Poloniex.py", line 143, in api_query tindolt_1 | raise ex tindolt_1 | ValueError: No JSON object could be decoded

easye35 avatar May 09 '21 16:05 easye35

Seems that it only happens when Poloniex is giving a 502 error msg

easye35 avatar May 09 '21 18:05 easye35

There should be error handling for error 502, maybe Polo changed something.

rnevet avatar May 09 '21 18:05 rnevet

I see that section in poloniex.py. But that's where the error coming from. not sure why though, doesn't seem to be handling error. At least that's what it looks like to me.

easye35 avatar May 09 '21 22:05 easye35