Tcl 启动脚本中出错:子进程异常退出

Tcl 启动脚本中出错:子进程异常退出,tcl,tk,Tcl,Tk,我正在处理我的第一个tcl/tk项目,但是每当我运行脚本时,它都会显示这个错误 Error in startup script: child process exited abnormally while executing "exec which [string tolower $css]" (procedure "::Ui::scriptSettings" line 16) invoked from within "::Ui::scriptSettings $::Ui::scriptSett

我正在处理我的第一个tcl/tk项目,但是每当我运行脚本时,它都会显示这个错误

Error in startup script: child process exited abnormally
while executing
"exec which [string tolower $css]"
(procedure "::Ui::scriptSettings" line 16)
invoked from within
"::Ui::scriptSettings $::Ui::scriptSettings"
(procedure "::Ui::Ui" line 15)
invoked from within
"::Ui::Ui"
(file "./init.tcl" line 266)
它总是在这条线上

$installationPath insert 0 [exec which [string tolower $css]]
$css是存在于/usr/bin文件夹中的路径

这是触发错误的过程

foreach css $::Ui::CSS {
    set cssScriptLabel [labelframe $settingsCssFrame.cssLabel$i -text $css]
    set optionalArgument [label $cssScriptLabel.optArg$i -text "Optional Arguments"]
    set optArgEntry [entry $cssScriptLabel.optArgEntry$i]

    set outFileLabel [label $cssScriptLabel.outFile$i -text "OutFile/OutDir"]
    set outFileEntry [entry $cssScriptLabel.outFileEntry$i]
    set installationPathLabel [label $cssScriptLabel.installLabel$i -text "Intallation Path"]
    set installationPath [entry $cssScriptLabel.installPath$i]
    $installationPath delete 0 end
    $installationPath insert 0 [exec which [string tolower $css]]
    grid $cssScriptLabel -pady 5 -columnspan 1
    grid $optionalArgument $optArgEntry -sticky news
    grid $outFileLabel $outFileEntry -sticky news
    grid $installationPathLabel $installationPath
    incr i;
}

我要做的是将输入框中的文本替换为路径名$css

这听起来像是
调用找不到程序。当它找不到它时,它会以一个非零的退出代码退出,Tcl(正确地!)将其解释为一个问题,并引发一个错误。您可以使用
catch
try
处理这些错误

try {
    $installationPath insert 0 [exec which [string tolower $css]]
} trap CHILDSTATUS {} {
    # No such program; recover here...
}
改为使用
catch
(它捕获所有错误,包括语法错误等):


听起来像是
调用找不到程序。当它找不到它时,它会以一个非零的退出代码退出,Tcl(正确地!)将其解释为一个问题,并引发一个错误。您可以使用
catch
try
处理这些错误

try {
    $installationPath insert 0 [exec which [string tolower $css]]
} trap CHILDSTATUS {} {
    # No such program; recover here...
}
改为使用
catch
(它捕获所有错误,包括语法错误等):

在shell提示下手动键入时,
哪个
显示什么?在shell提示下手动键入时,
哪个
显示什么?