1 year ago

#122498

test-img

GMA

how to remove six.reraise in Python 3?

I have some Python legacy code that looks like this:

except ValueError as e:
    new = DecodingError(
        "Failed to decode value {!r} for field {}, got: {}".format(
            raw_value, field_name, e
        )
    )
    six.reraise(DecodingError, new, sys.exc_info()[2])

Everything is on Python 3 so I don't need six anymore and would like to remove that dependency. But I don't understand what reraise does and how I can replace it with native Python 3 syntax. I don't find the explanation in the docs to be much help.

What should I replace six.reraise(...) with in Python 3?

python

python-3.x

six

0 Answers

Your Answer

Accepted video resources