如題,請問各位大俠咋回事
class Thread(threading.Thread):
def __init__(self, name, sub):
threading.Thread.__init__(self)
self.name = name
self.sub = sub
def run(self):
while True:
if self.sub.poll() is not None:
break
command = bytes(str(input("console:").encode('utf-8')), encoding="utf-8")
# print(type(command))
self.sub.stdin.write(command)
is_input_started = False
while True:
empty = False
try:
enter = str(input('主檔案路徑:'))
except SyntaxError:
empty = True
if not empty:
if str(input('確定路徑嗎?(y,n):')) == 'y':
break
sub = subprocess.Popen(enter, shell=True, stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.PIPE)
while True:
if sub.poll() is not None:
print('Stopped')
break
out = sub.stdout.readline()
if not out == "":
print(out)
if not is_input_started:
thread = Thread.Thread('input', sub)
thread.start()
is_input_started = True
輸入后并沒有任何反應,怎么辦
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/131223.html
