How to pass args to embedded python sub-interpreter? -



How to pass args to embedded python sub-interpreter? -

i need interpret few files (scripts) embedded python interpreter concurrently (to more detailed 1 script executes script popen , app intercepts , executes itself). i've found it's called sub-interpreter , i'm going utilize it. i've read sub-interpreter not have sys.argv:

the new environment has no sys.argv variable

i need pass argv anyway how can it?

you might find easier modify each of scripts follow pattern:

def run(*posargs, **argdict): """ work , can called with: import scriptname scriptname.run(someargs) """ # code goes here , uses posargs[n] utilize sys.argv[n+1] if __name__ == "__main__": import sys run(sys.argv[1:])

then main script can phone call each of subscripts in turn calling run method.

python interpreter argv

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -