【发布时间】:2011-09-23 16:20:45
【问题描述】:
我是 python 新手,我正在尝试使用两个查找命令创建一个仅搜索 2 个目录的搜索栏,并将结果输出到有序列表 []。
def search_entry(self, widget,):
s1 = subprocess.Popen(['find /home/bludiescript/tv-shows', '-type f'], shell=False, stdout=subprocess.PIPE)
s2 = subprocess.Popen(['find /media/FreeAgent\ GoFlex\ Drive/tobins-media', '-type f'], stdin=s1.stdout, shell=False, stdout=subprocess.PIPE)
s1.stdout.close()
self.contents = "\n".join(self.list)
s2.communicate(self.contents)
我的搜索栏:
self.search = gtk.Entry()
self.search.connect("activate", self.search_entry,)
self.box1.pack_start(self.search, True, True, 0)
self.search.show()
错误消息:
File "/usr/lib/python2.7/subprocess.py", line 679, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1228, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
【问题讨论】:
标签: python pygtk subprocess pipe