[英]Python Subprocess.Run inserting escape characters into program arguments
subprocess.run([program,'-force-gfx-jobs native -token='+PHPSESSID+ ' -config={"BackendURL":"https://prod.app.com","Version","live"}'])
When this command is run and you took in task manager at the command line values passed to the program the double quotes are prefixed by backslashes like this当运行此命令并且您在传递给程序的命令行值中获取任务管理器时,双引号以反斜杠为前缀,如下所示
subprocess.run([program,'-force-gfx-jobs native -token='+PHPSESSID+ ' -config={\"BackendURL\":\"https://prod.app.com\",\"Version\",\"live\"}'])
You are passing a single string where you should be passing a list of strings.您正在传递一个字符串,您应该在其中传递一个字符串列表。
subprocess.run([program,'-force-gfx-jobs', 'native',
'-token='+PHPSESSID, '-config={"BackendURL":"https://prod.app.com","Version","live"}'])
I don't think the displayed backslashes are a problem;我不认为显示的反斜杠有问题。 they are just for disambiguation (but this is Windows, so I'm probably underestimating the amount of crazy).它们只是为了消除歧义(但这是 Windows,所以我可能低估了疯狂的数量)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.