Hi, i need a simple python code which would trigger a command if there is an internet connection; if there isn't, sleep for some time and check again until there is.
I found few examples, but they're all rather difficult to grasp and being new to python, I can't get them working. If there really is no simple solution for this in Python, i'll try and go with the other ones. Thanks!
Recommended Answers
Jump to PostI would just try to open any sure to be up url in try statement inside while True loop. In else statement of try I would put activity for internet open. Most likely a function call.
Jump to PostYou can not put assignment as while condition.
All 8 Replies
TrustyTony
888
pyMod
Team Colleague
Featured Poster
layr
0
Newbie Poster
TrustyTony
888
pyMod
Team Colleague
Featured Poster
layr
0
Newbie Poster
TrustyTony
888
pyMod
Team Colleague
Featured Poster
layr
0
Newbie Poster
layr
0
Newbie Poster
TrustyTony
888
pyMod
Team Colleague
Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.