Reload the network configuration directly from a python sript ?

Discussion in 'Python' started by HIL, Oct 13, 2005.

  1. HIL

    HIL Guest

    Hi everybody,

    I wrote a python script to setup my network interface under Linux. To
    perform it, I use directly from my python script external programs as
    'ifconfig' and 'route' ans I fill the file /etc/resolv.conf with the good
    nameserver IP. So, it it works and my network is up.

    My problem is that when I use the function socket.gethostbyaddr just after
    setting up the network and without getting out of my script, I get an
    exception socket.herror. If I start my script again, now the function
    socket.gethostbyaddr works correctly.

    Python seems to load the network configuration at startup, and if network is
    not set at this moment, it does not reload changes.

    So, does someone know how to reload the network configuration directly from
    my script without restarting it ?

    Thanks by advance.

    HIL
    HIL, Oct 13, 2005
    #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. Carlos

    file management sript

    Carlos, Jul 28, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    362
    Carlos
    Jul 28, 2003
  2. Joshua Beall
    Replies:
    26
    Views:
    219,983
    AndreiKaa
    Jun 29, 2007
  3. gen_tricomi
    Replies:
    2
    Views:
    728
    gen_tricomi
    May 23, 2006
  4. Kingdom
    Replies:
    0
    Views:
    95
    Kingdom
    Oct 9, 2003
  5. Stefan Mueller
    Replies:
    4
    Views:
    281
    Stefan Mueller
    Nov 5, 2005
Loading...

Share This Page