I want to open a python script from an other python scrip but in the virtualenv
I tried os.system
and subprocess.call
but they couldn't open the virtualenv
os.system("workon cv") warning:
sh: 1: workon: not found
cmd = 'workon cv'
subprocess.call(cmd.split()) error:
OSError: [Errno 2] No such file or directory
I solved the problem:
the python script where I want to call the other python script should be opened in the virtualenv
put all the code in main function and import the file: import FileName
then call the main function: FileName.main()