You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fromfuture.utils.surrogateescapeimportregister_surrogateescaperegister_surrogateescape()
printu'\u03b1'.encode("iso-8859-1", "surrogateescape")
=>future/utils/surrogateescape.pycinreplace_surrogate_encode(mystring)
84ifnot0xD800<=code<=0xDCFF:
85# Not a surrogate. Fail with the original exception.--->86raiseexc87# mybytes = [0xe0 | (code >> 12),88# 0x80 | ((code >> 6) & 0x3f),NameError: globalname'exc'isnotdefined
This is because replace_surrogate_encode tries to refer to the exception of its calling context, which obviously fails. A simple fix might be to pass that exception in as an argument.