It's same to golang, I need to check network connect at first.
On Windows
from ping3 import ping
def check_connect(IP_address == None):
s = ping(IP_address)
print("s = ", s)
if s == None:
print("-----ERROR!-----")
else:
print("-----OK!-----")
On ubuntu
from ping3 import ping
def check_connect(IP_address == None):
s = ping(IP_address)
print("s = ", s)
if s:
print("-----ERROR!-----")
else:
print("-----OK!-----")
If ping successed, the ping back time will given to the parameter s.
But is ping failed, s will be None on Windows and be false on Ubuntu.
This is a point need take care of.