1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
import sys
if __name__ == '__main__':
if 'in-sub' not in sys.argv:
import os
# These functions all execute a new program, replacing the current process; they do not return.
# os.execl(path, arg0, arg1, ...)
# os.execle(path, arg0, arg1, ..., env)
# os.execlp(file, arg0, arg1, ...)
# os.execlpe(file, arg0, arg1, ..., env)ΒΆ
# os.execv(path, args)
# os.execve(path, args, env)
# os.execvp(file, args)
# os.execvpe(file, args, env)
os.execvp(sys.executable, [sys.executable, __file__, 'in-sub'])
else:
print('In sub')
print('TEST SUCEEDED!')
|