Checking for network connectivity

Discussion in 'Python' started by felciano, Jun 19, 2008.

  1. felciano

    felciano Guest

    Hi --

    Is there a clean pythonic way to check for network connectivity? I
    have a script that needs to run periodically on a laptop to create a
    local cache of some network files. I would like it to fail gracefully
    when disconnected, as well as issue a warning if it hasn't been able
    to connect for X minutes / hours.

    I currently just use try / except to catch the network errors when the
    first call times out, but the timeout takes a while, and this doesn't
    feel like the right design because technically this isn't an exception
    -- it is expected behavior. Is there a better way to do this (and
    still be reasonably portable)?

    Thanks,

    Ramon
     
    felciano, Jun 19, 2008
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kal
    Replies:
    1
    Views:
    9,529
    Kevin Spencer
    Jun 21, 2004
  2. Jane Davis

    Network Service account over network

    Jane Davis, Jun 22, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    451
    Kevin Spencer
    Jun 22, 2005
  3. Replies:
    0
    Views:
    362
  4. Bill Volk
    Replies:
    1
    Views:
    3,154
    Bill Volk
    Jul 2, 2003
  5. kin
    Replies:
    0
    Views:
    918
Loading...

Share This Page