os.system(sys.executable+" "+sys.prefix+"/bin/"+arg)
This is part of the pip console app that comes with qpython for android
os.system(sys.executable+" "+sys.prefix+"/bin/"+arg)
This is part of the pip console app that comes with qpython for android
A better way might be to use subprocess.run
and os.path.join
:
from subprocess import run
from os.path import join
from sys import executable, prefix
run([executable, join(prefix, 'bin', arg)])
The interface is much cleaner and more robust. It also offers much more control over how the process is called.
Notice that you can use a list for the arguments instead of artificially concatenating them. This makes life much easier if the path contains a space.
I think this is more pythonic but still needs something.
def modcmd(arg):
exe = sys.executable + ' '
prefix = sys.prefix + '/bin/'
cmd = exe + prefix + arg
os.system('clear')
os.system(cmd)