Python subprocess calling a python script

If you are going to run another python script (using Python), don't forget to use sys.executable for Python interpreter's path

Something like this:

import subprocess  
import sys[sys.executable, ''])  

This way you can guarantee that a script being called is run under the same Python's environment as the caller.

Konpat Preechakul

Read more posts by this author.