[Tutor] Subprocess help

Danny Yoo dyoo at hashcollision.org
Sun Sep 21 03:24:47 CEST 2014


> The command I need to run is "BYPASSROOT=yes ./octosetupBROADCASTER-linux_i386.bin"

Semantically, the command above means:

    execute "./octosetupBROADCASTER-linux_i386.bin" in an environment
that binds BYPASSROOT to "yes".

The subprocess.Popen command takes in an optional "env" argument, so
that's what you want to provide when creating this new subprocess.
Here's a link to the documentation.

    https://docs.python.org/2/library/subprocess.html#subprocess.Popen

So you'll probably want to do something like:

    envCopy = os.environ.copy()
    envCopy['BYPASSROOT'] = 'yes'
    subprocess.Popen(["./octosetupBROADCASTER-linux_i386.bin"], env=envCopy)


More information about the Tutor mailing list