refs #8125. Fix failing test.

Statement moved outside of try-except block