I am trying to call a shell script from a Python program which in turn runs a Python program.So i created one file called run.sh
have following lines of code,
source venv/bin/activate
python main.py
The above script will be called by this code,
from pathlib import Path
import os
import subprocess
class Handler:
ENTRYPOINT = 'run.sh'
def run(self, project_path):
if os.path.exists(project_path):
subprocess.call(['bash', project_path+self.ENTRYPOINT])
else:
print('Project path does not exist!')
So, whenever the above run method is executed It throws this error
python: can't open file 'main.py': [Errno 2] No such file or directory
The run.sh file & main.py file resides in the same level. I don't know much about shell scripting & just Googling my way around but I can't find the reason for the above error.Not even sure if it has anything to do with that shell script.Any help would be highly appreciated.