I've two Python scripts as given below
inner.py
#!/usr/bin/python
import os
import datetime
# <---- Some Code--->
main.py
#!/usr/bin/python
import os
import datetime
# <---- Some Code--->
subprocess.call(["/usr/bin/python",inner.py])
The problem is when the inner.py script is called from the main.py script it doesn't import any modules. For example it says
ImportError: No module named os
But when the script is executed standalone it works fine. Please help
sys.executableinstead of/usr/bin/pythonto make sure you are using the exact same Python binary.import sysdo? If that works, what doesprint sys.pathgive you?osfails to import? Doesimport subprocesswork? Doesimport urllibwork?