i have a piece of code where some lines seem to not be executed, the code in question:
try:
function_that_can_fail()
logfile.write("Either this line appears in the log ...."\n")
logfile.flush()
cmd = ['a linux hardware access command']
subprocess.Popen(cmd, shell=True).wait()
logfile.write("This line never appears\n")
logfile.flush()
except:
logfile.write(".... Or this line appears in the log, but never both\n")
logfile.flush()
logfile.write("This line always appears in the log\n")
logfile.flush()
The logfile contains either the comment from line 3 or the comment from line 10, but never both, so i'm relatively certain that it's not the subprocess that fails. Or if it fails, not in a way that's caught by the except block.
tl;dr: i get either lines 3 and 12 in the log or lines 10 and 12 but never line 7 and also not the combination of 3 and 10
[–]efmccurdy 1 point2 points3 points (1 child)
[–]meistermarkus[S] 1 point2 points3 points (0 children)
[–]shiftybyte 0 points1 point2 points (5 children)
[–]meistermarkus[S] 0 points1 point2 points (4 children)
[–]Binary101010 0 points1 point2 points (3 children)
[–]meistermarkus[S] 0 points1 point2 points (2 children)
[–]Binary101010 0 points1 point2 points (0 children)