我无法使用 .Popen() 和 .shlex() 获取通过 deluge-console 加载文件的脚本。我在 gnome-terminal 上使用 xubuntu 和 byobu。
def torrentLoad(url):
#client_run = subprocess.Popen(['deluged']])
sourceList = torrentWrite(sortXML(url))
print(sourceList)
for s in sourceList:
sleep(2)
delugeList = ['deluge-console', 'add', s]
load = subprocess.Popen(delugeList, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out, err = load.communicate()
print(out, err)
变量 sourceList 包含解析 xml 并返回 torrent 文件位置列表的函数。(例如'/home/YOURHOME/Documents/torrents/file.torrent')
理论上这应该输入命令:deluge-console add /home/YOURHOME/Documents/torrents/file.torrent 直接到终端。请注意,我也在运行 Byobu。我不知道这是否会在其中发挥作用。
我得到的输出是nodda。Zilch。感谢您的帮助。