如果我正确理解这一点,那么当发生错误时,Lua默认会调用调试库“debug.traceback”。 然而,嵌入的Lua为C代码的时候喜欢在这里的例子做: Simple Lua API Example 我们只有在堆栈的顶部的错误消息。 即 if (status) {
/* If something went wrong, error message is at the top of */
我阅读了关于追溯错误的Python问题的答案,唉,我不明白所提供的答案。当我运行下面的代码时,如果用户什么都不输入,我会得到一个回溯错误。我怎样才能避免它?请只给出具体和简短的答案。谢谢! Error: Python Traceback Error: Invalid Literal for int() with base 10 def gold_room():
print "This r
我有一个需要完全停止处理,一旦某个条件已经触发的程序 - 类似这样的问题:How do I abort the execution of a Python script? 然而,在我的情况,我想捕捉回溯是sys.exit()生成并最重要的是停止处理超出该点的任何代码块。有人能帮忙吗? try:
a = 'i'/1
print 'Does this work yet?'
exc
我已经注意到我过去非常喜欢写以下的尝试 - 除外语句。主要原因是编写较少的代码。 class Synchronizer(object):
# ...
def _assert_dir(self, dirname, argname, argnum):
""" *Private*. Raises OSError if the passed string does not