I have a problem launching an executable from python. I boiled it down to this:
#!/usr/bin/python
import os
py_path='/home/jdoe/python/1509/bin/python'
os.execl( py_path, '/home/jdoe/run.py' )
This fails:
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
ImportError: No module named site
I tried adding PYTHONHOME to the script and got other errors, but my question is: why does the script fail when:
/home/jdoe/python/1509/bin/python /home/jdoe/run.py
works?
os.exec() uses the calling script environment, so it should be just the same. What am I missing here?
subprocesscan't handle. If they'refork()ing off a new process to do this exec, they'd be better off withsubprocess; but if they want that new interpreter to take over their existing process's PID, thenos.exec* would be the right tool for the job.