Jan-07-2022, 06:05 PM
Hi Tim/lucasbazan,
Thank you for your response.
I tried your suggestion but its not working for me.
I gone through the documentation and try adding few more arguments to the code, but still no luck. Pasted below is my code
Any other suggestions to solve this? Is there any way to know whether the executable got executed?
Or is there any way to see that message("Enable QSE API? (Y/n)" in the terminal itself?
Thank you for your response.
I tried your suggestion but its not working for me.
I gone through the documentation and try adding few more arguments to the code, but still no luck. Pasted below is my code
from subprocess import Popen, PIPE process=Popen(['/home/user/Automation/test_app', '-g'], stdout=PIPE, stderr=PIPE, stdin=PIPE, shell=True, universal_newlines=True) print("return value",process) stdout=process.communicate(input='y',timeout=3) print(stdout)while executing the code i am always getting timeout and pasted below is the error message /log.
Error:user@user-laptop:~/Automation$ python3 sub.py
return value <subprocess.Popen object at 0x7f8dd3046240>
Traceback (most recent call last):
File "sub.py", line 6, in <module>
stdout=process.communicate(input='y',timeout=3)
File "/usr/local/lib/python3.6/subprocess.py", line 843, in communicate
stdout, stderr = self._communicate(input, endtime, timeout)
File "/usr/local/lib/python3.6/subprocess.py", line 1515, in _communicate
self._check_timeout(endtime, orig_timeout)
File "/usr/local/lib/python3.6/subprocess.py", line 871, in _check_timeout
raise TimeoutExpired(self.args, orig_timeout)
subprocess.TimeoutExpired: Command '['/home/user/Automation/test_app', '-g']' timed out after 3 seconds
user@user-laptop:~/Automation$
Note: After the error is occurring i am not able to run the script again in the same terminal, may be the process might me running in the background and occupying it. Any other suggestions to solve this? Is there any way to know whether the executable got executed?
Or is there any way to see that message("Enable QSE API? (Y/n)" in the terminal itself?