[lug] Python: Unable to catch subprocess error
Andrew Louder
ajlouder at yahoo.com
Sat Mar 10 15:13:56 MST 2018
10 years ago I did test automation with python running on: Windows + Linux.What I did was using a script to output the error code, then use a regular expression in the output to find the error code.I found that that gathering the entire output was convenient for defect creation anyway.
Andy
WIN batch: echo %errorlevel%LIN bash: echo $?a better deterministic regular expression would be:echo "UniqueRtnCode=\{$?\}" On Friday, March 9, 2018, 8:01:29 PM MST, Jed S. Baer <blug at jbaer.cotse.net> wrote:
On Fri, 9 Mar 2018 19:34:38 -0700
Davide Del Vento wrote:
> With python the easiest is looking at the source. See
> /usr/lib/python2.7/subprocess.py
> on line 1327 (or previous in the stack trace) and see.
Heh. While I appreciate the suggestion, I'd really like to think that
such would be necessary only in cases of really bizarre constructs. Is it
really not possible to grok the basics from the docs? That's a part of
the thought process behind the scenes. I learned Fortran and Macro-11 by
reading the DEC manuals, and C by reading K&R. (Just 3 examples.) If I'm
going to run into stuff like this all the time in Python, I'll just go
back to Perl (or try something else).
_______________________________________________
Web Page: http://lug.boulder.co.us
Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug
Join us on IRC: irc.hackingsociety.org port=6667 channel=#hackingsociety
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lug.boulder.co.us/pipermail/lug/attachments/20180310/963634c0/attachment.html>
More information about the LUG
mailing list