python - 嘿 python 解析 tcl 变量?核武器

标签 python tcl nuke

因此,我试图让 python 打印一个包含 tcl 变量的字符串,以及该变量的结果。我正在使用 nuke,以防对我的代码很重要。

[set THIS image] 
Ln = "/Test/still/testing/$THIS\_clean_v001"
print(Ln) # this prints exactly the above

G = nuke.tcl('[puts "$THIS"] ') 

print(G) 会返回图像这个词吗?

然后我可以把它分进去。问题是我输入那个 tcl 的文本字段在程序中很好地解决它,但是一旦我发送它来处理它就需要 $THIS字面意思。

最佳答案

需要注意两点:

  1. Tcl puts 不返回值。听起来你想要 Tcl set , 确实如此。

  2. nuke.tcl 的文档位于 http://www.nukepedia.com/reference/Python表明:

    tcl(command, arg, arg, ...)

    Run a tcl command. The arguments must be strings and passed to the command. If no arguments are given and the command has whitespace in it then it is instead interpreted as a tcl program (this is depreciated)

与其将其作为完整脚本调用,您似乎既可以使用未弃用的版本,又可以通过以下方式获得所需的行为:

G = nuke.tcl("set", "THIS")

应该返回 THIS 变量的值。

关于python - 嘿 python 解析 tcl 变量?核武器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16180880/

相关文章:

python - Tensorflow:将灰度图像转换为RGB

TCL - 将 STDIN 提供给执行程序

tcl - 定义和循环遍历数组 tcl

c - 如何找到哪个 C 函数正在调用特定的 TCL 过程?

python - 如何创建全局运动模糊参数并进行全局控制?

python - Scipy.misc 导入不起作用

python - 如何使用 AirFlow 运行 python 文件的文件夹?

python - 如何使用 python 选择特定的 CSV 行

python - 如何在终端模式执行(批处理模式)中找到节点的宽度?