使用格式时 Tcl 中的命令名称无效
我正在运行以下命令
set full_pin_name [format "%s %s" $top_cell $encoded_name]
puts "full_pin_name is $full_pin_name"
,但收到以下错误:
full_pin_name is invalid command name "A" B
当 top_cell
等于 A 且 encoded_name
等于 B 时。
为什么会发生这种情况?
I'm running the following commands
set full_pin_name [format "%s %s" $top_cell $encoded_name]
puts "full_pin_name is $full_pin_name"
and I get the following error:
full_pin_name is invalid command name "A" B
when top_cell
equals A and encoded_name
equals B.
Why is this happening?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
我怀疑问题出在您的 $top_cell 变量上,该变量的值为无效的命令名称“A”。要进行检查,请在格式行之前尝试以下行:
如果 $top_cell 值确实有问题,则可以追溯到最后一个 set 命令。请告诉我们它是否可以解决您的问题,否则我们可能会尝试其他方法。
I suspect the problem is with your $top_cell variable, which has the value invalid command name "A". To check, try the following line before your format line:
If indeed, $top_cell value has a problem, you can then trace back to the last set command. Let us know if it fixes your problem, or we might try some other approaches.
尝试在普通的 Tcl shell 中重复此操作,它可以工作。您的 Tcl shell 中有些东西不同。
尝试
一下,
如果报告除
set isn't a procedure
或format isn't a procedure
以外的内容,那么您就找到了罪魁祸首。Try repeating this in a plain Tcl shell, it works. Something is different in your Tcl shell.
Try
and
If either report something other than
set isn't a procedure
orformat isn't a procedure
then you have your culprit.这段代码可能运行在定义了
set
命令的命名空间中吗?演示:
May be this code runs in a namespace which has the
set
command defined in it?To demonstrate:
据我所知,这里没有 TCL 解释器,假设有定义格式的普通解释器应该可以工作。所以看起来格式可能已被重命名或者在您使用的解释器中不作为命令存在?
为了让你继续前进,你实际上并不需要格式来连接字符串,无论如何
设置 fill_pin_name "$top_cell $encoded_name"
应该是你所需要的
As far as I can tell without a TCL interpreter here it should work assuming a normal interpreter with format defined. so it looks like maybe format has been renamed or doesn't exist as a command in the interpreter you are using?
To get you going you don't really need format to join strings anyway
set fill_pin_name "$top_cell $encoded_name"
should so what you need
也许您的代码如下所示:
结果是:
Maybe your code looks like this:
The result is: