在Cygwin上通过套接字运行Python脚本时,我经常遇到以下错误:
Traceback (most recent call last):
File "M:/view/cmtest_ccProxy/bce/cmTools/lib/CC.py", line 321, in standAlone
results = Process.execute (cmd = cmd, opts = opts)
File "M:/view/cmtest_ccProxy/bce/cmTools/lib/Process.py", line 327, in execute
timeout = timeout)
File "/usr/local/lib/python3.4/subprocess.py", line 535, in call
with Popen(*popenargs, **kwargs) as p:
File "/usr/local/lib/python3.4/subprocess.py", line 848, in __init__
restore_signals, start_new_session)
File "/usr/local/lib/python3.4/subprocess.py", line 1382, in _execute_child
restore_signals, start_new_session, preexec_fn)
BlockingIOError: [Errno 11] Resource temporarily unavailable
设置是: 服务器端: 为cygwin构建的Cygwin + inetd + python 客户端: telnet服务器
python脚本运行具有大输出的命令。
import subprocess, os, tempfile, re
def execute (cmd = None,
opts = None,
log = None,
verify = False,
cmdlog = False,
audit = False,
logappend = False,
ignorestatus = False,
umask = None,
host = None,
interrupt = None,
timeout = None,
forceaudit = False):
global __signal
global __signalList
returnData = {"status": 0, "rawstatus": 0, "interrupt": 0,
"stdout": None, "stderr": None}
os.environ["ENV"] = ""
stdOutHandle, stdOut = tempfile.mkstemp (text = True)
stdErrHandle, stdErr = tempfile.mkstemp (text = True)
if re.match ("\s", cmd): cmd = "'" + cmd + "'"
cmd = [cmd]
opts = opts.split()
cmd.extend (opts)
if not verify:
if umask: originalUmask = os.umask (umask)
if interrupt:
for idex, item in enumerate (__signalList):
if item: signal.signal (idex, interrupt)
__signal = 0
returnData["rawstatus"] = subprocess.call (cmd, stdout = stdOutHandle,
stderr = stdErrHandle,
timeout = timeout)
returns = returnData["rawstatus"]
任何灯光都会受到赞赏!
BR,