本文整理匯總了Python中popen2.popen3方法的典型用法代碼示例。如果您正苦於以下問題:Python popen2.popen3方法的具體用法?Python popen2.popen3怎麽用?Python popen2.popen3使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類popen2
的用法示例。
在下文中一共展示了popen2.popen3方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_popen3
# 需要導入模塊: import popen2 [as 別名]
# 或者: from popen2 import popen3 [as 別名]
def test_popen3(self):
if os.name == 'posix':
r, w, e = popen2.popen3([self.cmd])
self.validate_output(self.teststr, self.expected, r, w, e)
r, w, e = popen2.popen3(self.cmd)
self.validate_output(self.teststr, self.expected, r, w, e)
示例2: test_os_popen3
# 需要導入模塊: import popen2 [as 別名]
# 或者: from popen2 import popen3 [as 別名]
def test_os_popen3(self):
# same test as test_popen3(), but using the os.popen*() API
if os.name == 'posix':
w, r, e = os.popen3([self.cmd])
self.validate_output(self.teststr, self.expected, r, w, e)
w, r, e = os.popen3(["echo", self.teststr])
got = r.read()
self.assertEqual(got, self.teststr + "\n")
got = e.read()
self.assertFalse(got, "unexpected %r on stderr" % got)
w, r, e = os.popen3(self.cmd)
self.validate_output(self.teststr, self.expected, r, w, e)
示例3: fetchList
# 需要導入模塊: import popen2 [as 別名]
# 或者: from popen2 import popen3 [as 別名]
def fetchList(self):
(stdout, stdin, stderr) = popen3("%s --getfilelist '%s*.*'" % (self.bin, self.dir))
list = stdout.readlines()
# Useless gnokii prompt
del list[0]
# Get rid of whitespaces at the ends of the file name
self.file_list = map(lambda x: x.strip(), list)
示例4: fetchPhoto
# 需要導入模塊: import popen2 [as 別名]
# 或者: from popen2 import popen3 [as 別名]
def fetchPhoto(self, p):
print "Fetching file %s..." % p
(stdout, stdin, stderr) = popen3("%s --getfile '%s%s' '%s/%s'" % (self.bin,
self.dir, p, self.dest, p))
# Make it blocking, so the program will wait for gnokii
stdout.read(1)