Open northbear opened 1 year ago
HI, We are using modernize for upgrading a code. And we get fails after replacing raise with six.reraise in a function below:
def reformat_raise_error(header='', footer=''): if DEBUG or (not header and not footer): raise raise sys.exc_info()[0], '%s %s %s' % (header, sys.exc_info()[1], footer), sys.exc_info()[2]
It get translated in this way:
def reformat_raise_error(header='', footer=''): if DEBUG or (not header and not footer): raise six.reraise(sys.exc_info()[0], '%s %s %s' % (header, sys.exc_info()[1], footer), sys.exc_info()[2])
it falls with an error: type 'str' has no attribute __trackback__.
I tried to refactor the raise call.
def reformat_raise_error(header='', footer=''): if DEBUG or (not header and not footer): raise t, v, tb = sys.exc_info() six.reraise(t, t(' '.join([header, str(v), footer])), tb)
But I got even more frustrated error when running it with python2.7:
six.reraise(t, t(' '.join([header, str(v), footer])), tb) TypeError: function takes exactly 5 arguments (1 given)
I'd appreciate any advice.
HI, We are using modernize for upgrading a code. And we get fails after replacing raise with six.reraise in a function below:
It get translated in this way:
it falls with an error: type 'str' has no attribute __trackback__.
I tried to refactor the raise call.
But I got even more frustrated error when running it with python2.7:
I'd appreciate any advice.