I'm trying to run a bash script from a Python script. Both this bash script and python script reside in the same directory. However, when I run the Python script, I get No such file or directory
error.
My current directory
xxx@xxx:/home# ls
check.sh sc.py
Following is the code I'm trying to run, sc.py
:
import subprocess
subprocess.Popen(["check.sh", "ABC"])
I'm getting the following error:
xxx@xx:/home# python3 sc.py
Traceback (most recent call last):
File "sc.py", line 2, in <module>
subprocess.Popen(["check.sh", "ABC"])
File "/usr/lib/python3.6/subprocess.py", line 729, in __init__
restore_signals, start_new_session)
File "/usr/lib/python3.6/subprocess.py", line 1364, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'check.sh': 'check.sh'
What am I doing wrong here?