2017-03-21 128 views
0
# 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!" 
} 

我有上面的代碼需要打開一個模板文件,前幾天還在工作,昨天剛開始顯示無法打開,可能有什麼幫助嗎?template_file無法打開

+0

任何更改進入該模板文件?像文件許可等?我認爲問題可能在於此。 –

回答

0

錯誤消息將在res變量中。那應該告訴你什麼是錯的;將其添加到中止消息,可能是這樣的:

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

然後你會發現它可能是明顯的。


在一般情況下,通過報道一些處理故障時,它的作爲常說的是什麼問題,報告實際的故障信息非常有用。我發現Tcl的消息是有用的,至少對於直接的錯誤是有用的。 (當然,更高級的原因爲什麼可以考慮)