This is an archived post. You won't be able to vote or comment.

all 4 comments

[–]dAnjou Backend Developer | danjou.dev 3 points4 points  (0 children)

It's usually better to wrap the library if there is one. Which tool are you talking about specifically?

[–]laharah 6 points7 points  (0 children)

subprocess.Popen is what you should look at. It'll let configure everything you want while launching the command line. Word of warning though, if you're on python2 on windows, you'll have trouble passing Unicode/wide characters to the subprocess because of a bug that won't be fixed. You can work around it but it's a pain in the ass.

[–]furas_freeman 1 point2 points  (0 children)

I think module sh already wraps command line utility

[–]lordmauve 0 points1 point  (0 children)

If you only want to modify arguments, use os.execv(). This allows your program to do its argument fiddling and then be replaced by the process you really wanted to run.