On 08/24/2012 04:14 PM, Emile van Sebille wrote: > On 8/24/2012 3:36 PM Ray Jones said... >> My code: >> >> try: >> subprocess.check_call(['ping', '-w1', ip]) >> except CalledProcessError: >> print 'System', ip, 'is not responding. Exiting....' >> sys.exit(4) >> else: return None >> >> The result: >> >> Traceback (most recent call last): >> File "./testing.py", line 222, in <module> >> main() >> File "./testing.py", line 170, in main >> ip, port, endTime = parse_command_line(args) >> File "./testing.py", line 111, in parse_command_line >> ip = do_ip(args) >> File "./testing.py", line 85, in do_ip >> ping_ip(ip) >> File "./testing.py", line 44, in ping_ip >> except CalledProcessError: > > Try it as: > > except subprocess.CalledProcessError, e > print e.output It worked like a charm. Thanks.
Ray _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor