Linked Questions

Popular Questions

I am writing an Python wrapper where a Python script creates a custom env variable by adding a large number of elements.

For example:

env['DEBUG'] = '1'
env['TBB_NUM_THREADS'] = str(args.threads)

This first wrapper calls a second wrapper via subprocess.Popen like this:

command = [''] + args
subprocess.Popen(command, env=env).wait()

I need the second wrapper to have the same env as the first. Ideally, I would like to modify the above assignment so the second argument is the env. In this way the second script can easily access it and set its env to that of the first script.

command = [''] + env + args

But this causes the following error: "Typeerror: can only concatenate list (not "instance") to list"

What would be the best way to approach this problem? Note: I am using Python 2.7

Related Questions