Reload the network configuration directly from a python sript ?

H

HIL

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,043
Latest member
CannalabsCBDReview

Latest Threads

Top