On Thu, Feb 16, 2017 at 1:25 PM, Steven D'Aprano <st...@pearwood.info> wrote: > This has been in production for months, the writer of the code has left > and the new maintainer has been asked to find out why it has been > crashing with UnboundLocalError: > > > try: > result = future.result() > except requests.exceptions.ConnectionError as e: > pass > resp = self.client.service.GetModifiedTerminals( > __inject={'reply': result.content}) > > > Traceback (most recent call last): > [incriminating details removed for the protection of the guilty] > UnboundLocalError: local variable 'result' referenced before assignment >
Without even looking at the link.... 'except pass' around an assignment. Unless there's a preceding "result = some-other-object", that's going to annoyingly fail. Maybe "except return None"? ChrisA -- https://mail.python.org/mailman/listinfo/python-list