【发布时间】:2011-06-28 14:54:13
【问题描述】:
我有一个名为 test7.tcl 的文件:
namespace eval ::dai {
variable name "ratzip"
variable birthday "1982"
proc hello {} {
variable name
variable birthday
puts "Hello, I am $name birthday is $birthday"
}
}
我想将此文件导入另一个文件,以这种方式称为 test8.tcl:
source test7.tcl
::dai::hello
但它给了我错误:无法读取文件“test7.tcl”:没有这样的文件或目录
但是这两个文件在同一个文件夹下,怎么回事?
【问题讨论】:
-
我打赌你没有像这样运行 test8.tcl:
tclsh test8.tcl或source test8.tcl。相反,您位于不同的目录中,因此文件名不是您所期望的。使用file normalize test7.tcl进行诊断以查看完整文件名是否符合您的预期。
标签: tcl