template_file无法打开

时间:2017-03-21 04:06:36

标签: templates tcl

# Open user's template file
if [catch { set f_id [open "$ex_doc_template_file" r] } res] {
    # Close output file before abort
    global html_output_file_id

    catch { close $html_output_file_id }

    MOM_abort "$ex_doc_template_file can not be open!"
}
我上面的代码需要打开一个模板文件,前几天还在工作,昨天刚开始显示无法打开,可以帮忙解决一下是什么问题吗?

1 个答案:

答案 0 :(得分:0)

错误消息将出现在res变量中。这应该告诉你什么是错的;将其添加到中止消息中,可能是这样的:

MOM_abort "$ex_doc_template_file can not be open! $res"

然后你会发现它可能是显而易见的。

通常,在通过报告某些内容来处理失败时,它非常对报告实际失败消息非常有用,因为它通常会说明问题所在。我发现Tcl的消息很有用,至少对于即时错误是有用的。 (当然,为什么可以采取思考的更高层次的原因。)