相关疑难解决方法(0)

OSError:[Errno 22]子进程中的参数无效

Python 3.3.3 Windows 7

Here is the full stack:
Traceback (most recent call last):
  File "Blah\MyScript.py", line 578, in Call
    output = process.communicate( input=SPACE_KEY, timeout=600 )
  File "C:\Python33\lib\subprocess.py", line 928, in communicate
    stdout, stderr = self._communicate(input, endtime, timeout)
  File "C:\Python33\lib\subprocess.py", line 1202, in _communicate
    self.stdin.write(input)
OSError: [Errno 22] Invalid argument
Run Code Online (Sandbox Code Playgroud)

代码如下所示:

process = subprocess.Popen( arguments,
                stdin=subprocess.PIPE,
                stdout=subprocess.PIPE,
                stderr=subprocess.PIPE,
                universal_newlines=True,
                env=environment )

output = process.communicate( input=SPACE_KEY, timeout=600 )
Run Code Online (Sandbox Code Playgroud)

这段代码每天运行数百次没有问题.但是如果在同一台机器上运行多个脚本(相同的脚本,但有时来自不同的文件夹),我会收到错误.脚本没有执行相同的操作(即:当我收到此错误时,另一个脚本没有执行子进程).

subProcess代码使用许多不同的命令行来引发错误.

那么,任何人都知道发生了什么?解释器是否有多个执行问题(在不同的进程中)?相同的代码通常可以正常工作,如果解释器运行相同(或非常相似)的脚本,则会破解.但它们通常执行脚本的不同部分.

我很茫然:在8核机器上使用单个处理器很烦人.

python windows subprocess python-3.x

12
推荐指数
3
解决办法
1万
查看次数

标签 统计

python ×1

python-3.x ×1

subprocess ×1

windows ×1