I'm having some trouble running some binaries with subprocess.run
I have a binary file at /tools, lets call the binary program. So I need to call /tools/program.
Every option I try, subprocess shows that the file does not exist. I have tried the following.
ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
TOOL_DIR = ROOT_DIR + '/tools/program'
# All of the following return error not found
program_subprocess = subprocess.run(['./'+TOOL_DIR])
program_subprocess = subprocess.run(['./"'+TOOL_DIR+'"'])
# Tried without the /, cause TOOL_DIR has a slash at the start
program_subprocess = subprocess.run(['.'+TOOL_DIR])
Any idea on how to run binaries with subprocess.run using ./?
EDIT: Also tried
subprocess.run([./\"+TOOL_DIR+'\"'])
./?/tools/program. The program doesn't seem like its relative to your current working directory so,./isn't the right thing to use.gobased binarysubprocessand the way they go is almost the same. Could you post as answer?/somewhere/tools/programand./somewhere/tools/programare completely different paths, and there is a very high chance the latter does not exist. Just use the former without the., or use only./tools.program(without the root dir).