Skip to content

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

Closed
@ThomSawyer

Description

@ThomSawyer

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:

  • python-http-client version: 3.3.0
  • python version: 3.7

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugbug in the library

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions