I'm having issues with the subprocess module. I'm trying to run a terminal command in Python, which works perfectly fine in the terminal. The command is:
hrun SomeAction LogFile
I've tried a variety of options, including call(), run(), check_output(), and Popen(). No matter which method I use, I get the error:
FileNotFoundError: [Errno 2] No such file or directory: 'hrun': 'hrun'
My code is:
output = Popen(["hrun", "SomeAction", log_file_name], stdout=PIPE, stderr=PIPE)
where "hrun" and "SomeAction" are strings and log_file_name is a string variable. I found other SO issues and, most (if not all) were resolved with either shell=True (which I dont want), or because the issue was due to a string instead of a list argument.
Thanks!
#python