Print Failure or success based on the value of the standalone tool
Rob Gaddi
rgaddi at highlandtechnology.invalid
Thu May 10 12:54:33 EDT 2018
On 05/10/2018 09:48 AM, Ganesh Pal wrote:
> I have to test a standalone tool from a python script and I am using
> os.system() to run the tool . I need to take decision based on the return
> value of the standalone tool .
>
> But since os.system merely throws the output value to STDOUT & returns the
> exit status (0 => no error) of the shell , how can I make this print Fail
> or Pass based on the return value of the standalone tool.
>
> In the below example ( return_values() function)
>
[snip]
By not using os.system, it's been superseded for reasons exactly like
yours. https://docs.python.org/3/library/subprocess.html is your friend.
--
Rob Gaddi, Highland Technology -- www.highlandtechnology.com
Email address domain is currently out of order. See above to fix.
More information about the Python-list
mailing list