calling Python script from another Python script (Windows, multiple installation problem)

Martin Landa landa.martin at gmail.com
Wed Mar 26 13:49:33 CET 2014


Dne středa, 26. března 2014 13:29:47 UTC+1 Martin Landa napsal(a):

> not really, I am just searching for a better solution based on virtualenv or something similar...

particularly I am using something like

        if sys.platform == "win32":
            # get full path including file extension for scripts
            fcmd = get_real_command(args[0]) 
            if fcmd.endswith('.py'):
                args[0] = fcmd
                args.insert(0, sys.executable)

where 'args' in subprocess.Popen's argument. I just wonder if there is a better or preferable solution over this kind of a hack. Martin




More information about the Python-list mailing list