执行此命令我有这样的命令,它运行在提示:如何从Python的
echo "python setHeater.py" | at 16:30
我如何能够执行从一个Python程序?
在我的节目我创建了一个日期,CONCAT,为一个字符串,像这样
newtime = createnewtime()
commandToExecute = 'echo "python setHeater.py" | at ' + newtime
#and then here the code to actually run the command in the command environment
粘贴您的整个python脚本?你使用datetime来创建你的时间(使用createnewtime())的自定义函数吗?另外,最终目标是什么?真的只是打印这个标准输出?你是否试图通过sys/os模块“回显”这个? – 2013-03-25 15:35:54
为什么从python脚本运行python脚本?如果你真的想执行该命令,请参阅http://stackoverflow.com/questions/89228/calling-an-external-command-in-python。但我建议将setHeater.py中的内容导入到当前脚本中,并使用Python进行计划。否则,你有不必要的开销。 – 2013-03-25 15:38:05
@Jonathan我不想从我的python脚本运行python脚本,我正在尝试为我的脚本安排下一次运行 – Michel 2013-03-25 15:41:53