Python 子流程popen+;卷曲度+;二进制数据
以下语句按预期工作:Python 子流程popen+;卷曲度+;二进制数据,python,curl,popen,Python,Curl,Popen,以下语句按预期工作: os.system("curl --data-binary \@"+input_file_path+" -o "+ file_name +" localhost:30") 但在使用subprocess.popen尝试时: Popen(['curl','--data-binary','\@'+input_file_path, '-o', file_name,'localhost:30'], stdout=PIPE).communicate()[0] Curl似乎挂起了(登
os.system("curl --data-binary \@"+input_file_path+" -o "+ file_name +" localhost:30")
但在使用subprocess.popen
尝试时:
Popen(['curl','--data-binary','\@'+input_file_path, '-o', file_name,'localhost:30'], stdout=PIPE).communicate()[0]
Curl似乎挂起了(登录到无止境的循环中),就像没有将输入文件传递给它一样(这是localhost:30正常运行所必需的)
有什么想法吗?您可以尝试使用
subprocess.Popen
中的原始字符串以及shell=True的Popen
的附加关键字参数:
subprocess.Popen("curl --data-binary \@"+input_file_path+" -o "+ file_name +" localhost:30",
stdout=subprocess.PIPE,
shell=True)
您可以尝试在subprocess.Popen
中使用原始字符串,并在shell=True的Popen
中添加关键字参数:
subprocess.Popen("curl --data-binary \@"+input_file_path+" -o "+ file_name +" localhost:30",
stdout=subprocess.PIPE,
shell=True)
不调用系统的curl如何 不调用系统的curl怎么样 因为有时您根本不想等待响应或等待,只需将fork分离并忘记即可。另一个好的http python库是''library,因为有时您根本不想等待响应或等待,只需fork detach并忘记即可。另一个好的http python库是“”库