Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions urllib3.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
try:
import wget
execept:
import os
result = os.system("pip install wget")
try:
import wget
except ModuleNotFoundError:
if result == 0:
raise ImportError("Pip succeded, but wget was not found. Check PATH")
raise ImportError("Pip failed, unable to install wget")
except ImportError:
print("Unknown error whilst trying to import wget, pip code is %s"%result)
try:
download=wget.download
except Exception:
print("wget can't download, pip code is %s"%result)
raise ImportError("wget cannot download, perhaps you have another file wget.py?")
if result != 0:
print("Strange behaviour detected, pip failed but wget was imported correctly.")
def get(link):
wget.download(link)