Python在一个子进程中运行多个命令时出现问题。

2024-09-26 22:12:07 发布

您现在位置:Python中文网/ 问答频道 /正文

我是python的初学者,尝试在一个子进程调用中运行多个命令。在

这是我的代码:

import subprocess, sys, time

print ("Python OS 1.0")
print ("Using Python",sys.version)

livecommand = input(">>")

output = subprocess.call(livecommand,'time.sleep(10000.00)',shell=True)

print (output)

错误:

Traceback (most recent call last): File "C:\Users\John\Desktop\OS\FILES\console.py", line 8, in output = subprocess.call(livecommand,'time.sleep(10000.00)',shell=True) File "C:\Users\John\AppData\Local\Programs\Python\Python36-32\lib\subprocess.py", line 267, in call with Popen(*popenargs, **kwargs) as p: File "C:\Users\John\AppData\Local\Programs\Python\Python36-32\lib\subprocess.py", line 607, in init raise TypeError("bufsize must be an integer") TypeError: bufsize must be an integer


Tags: inpyoutputtimeossyslinesleep

热门问题