Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Dec 22, 2023. It is now read-only.

Commit 32c484a

Browse files
committed
Added a try and except block to handle the error due to no network connectivity.
1 parent f711aae commit 32c484a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

‎Scripts/Miscellaneous/Wifi_Speed/wifiSpeed.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,14 @@
22

33
# Python module for testing internet bandwidth
44
import speedtest
5+
from sys import exit
56

67
# Creating a instance
7-
s = speedtest.Speedtest()
8+
try:
9+
s = speedtest.Speedtest()
10+
except speedtest.ConfigRetrievalError:
11+
print('Sorry, looks like you are not connected to any network!\nPlease make sure you are connected to the internet.')
12+
exit()
813

914
# Menu
1015
print("Select a valid option from below:\n")

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /