本文整理汇总了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)