1

我试图让生菜在 python 3 上运行,但它没有工作。所以我很快2to3 'd 所有有问题的文件,现在我得到了这个问题:

处理找不到地形时,生菜会因为这条线而崩溃

sys.stderr.write(exceptions.traceback.format_exc(e))

这是由于:

   while curr is not None and (limit is None or n < limit):

极限是一个ImportError,不能与 n 比较,它是一个int

我该如何解决这个问题?

4

2 回答 2

1

def format_exc(limit=None, chain=True):python3 中的格式意味着您必须在错误中指定 e 的 kwarg:

sys.stderr.write(exceptions.traceback.format_exc(e))

必须是(通过消除)

sys.stderr.write(exceptions.traceback.format_exc(chain=e))

该调用假设e对应于第一个 kwarglimit

于 2015-01-14T16:05:08.237 回答
0

试试这个(没有e参数):

sys.stderr.write(exceptions.traceback.format_exc())
于 2017-09-29T09:25:12.113 回答