python - How can I use subprocess.Popen to run a method in another file while passing in multiple dictionaries? -
p = subprocess.popen(['python2.7', 'from some.path.foo import run_setup', 'import ast', 'nsvs = ' + str(new_system_variables), 'nsv = ast.literal_eval(nsvs)', 'us = ' + str(user_dict), 'u = ast.literal_eval(us)', 'run_setup(nsv, u)'], stdout=subprocess.pipe, stderr=subprocess.pipe)
above code. need have run_setup method run in background. run_setup in fact run current implementation, none of values in dictionaries seem passed in. new_system_variables , user_dict being 2 dictionaries i'm trying pass in. in advance!
use multiprocessing
instead;
from multiprocessing import process some.path.foo import run_setup p = process(target=run_setup, args=(new_system_variables, user_dict)) p.start() p.join()
Comments
Post a Comment