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:
NameError: global name 'CalledProcessError' is not defined

I didn't think Python return errors needed to be defined. I'll work
around it with call_output, but what the heck is going on here? What do
I not understand?
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to