subprocess.Popen not escaping command line arguments properly? subprocess.Popen not escaping command line arguments properly? curl curl

subprocess.Popen not escaping command line arguments properly?


perhaps using shell=True

push = subprocess.Popen(s, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)


Instead of doing

s.split()

try using shlex from the standard library

import shlexshlex.split(s)

Shlex allows you configure the escaping behavior (see the link for details, the defaults might be sufficient though)


Specifically where you are going wrong is splitting at:

\"Another, App\"}"

.split()# 

is using space-character by default you'll need to change split behaviour as others have said.