我一直在写一个脚本来检查天气。该脚本很好,并且作为 cronjob 工作得很好,但是,我现在试图将脚本(今天的天气预报)的结果显示在 conky 中。
我有一个 python-weather 脚本写入的文件“weather-outside”,然后我将它添加到 conkyrc 文件中:
${color grey}Weather:${scroll 16 $execi 3600 cat $/home/User/Desktop/misc./weather-outside | fold}
Run Code Online (Sandbox Code Playgroud)
的execi命令是假设在时间间隔设置为3600secs运行,但,这后运行时Conky的是错误消息:
Conky: execi needs arguments
Conky: Error destroying thread
***** Imlib2 Developer Warning ***** :
This program is calling the Imlib call:
imlib_context_free();
With the parameter:
context
being NULL. Please fix your program.
Run Code Online (Sandbox Code Playgroud)
我已将execi更改为exec但是,然后实际行 'cat $home/User/Desktop/misc./weather-outside | fold' 在 conky 上滚动而不是该文件中的文本?
不要使用 file 来获取要在 conky 中显示的信息。我不知道你是如何在 Python 中做到这一点的,但是当我编写 Java 应用程序以在 conky 中显示 twitter 提要时,我直接将它打印到控制台并使用了 execi。这就是我如何使用它
${execi 600 java -cp /home/aman/java/classes MyApp}
Run Code Online (Sandbox Code Playgroud)
你的文件路径对我来说也很奇怪。
通过这种方式,您可以保持天气信息更新,而无需更新文本文件。