sendgrid / python-http-client

Twilio SendGrid's Python HTTP Client for calling APIs
https://sendgrid.com
MIT License
125 stars 101 forks source link

UnboundLocalError: local variable 'exc' referenced before assignment #144

Closed ThomSawyer closed 4 years ago

ThomSawyer commented 4 years ago

Issue Summary

In the new release 3.3.0, the variable exc is referenced before assignement in the client.py file. It worked fine on version 3.2.7. It looks like L182 needs to be before L178.

Exception/Log

Exception

UnboundLocalError: local variable 'exc' referenced before assignment
python_http_client/client.py in _make_request at line 180

Log

try:
    return opener.open(request, timeout=timeout)
except HTTPError as err:
    _logger.debug('{method} Response: {status} {body}'.format(
        method=request.get_method(),
        status=exc.status_code,
        body=exc.body))
    exc = handle_error(err)
    exc.__cause__ = None
    raise exc

Technical details:

chrislondon commented 4 years ago

I'm getting this too

victorct-pronto commented 4 years ago

We are getting this too.

childish-sambino commented 4 years ago

Working on a fix ...

haritn commented 4 years ago

still getting this issue.

amanbedi23 commented 4 years ago

the latest pypi package still has the same issue. will this fix be updated on pypi?

childish-sambino commented 4 years ago

Released.