add basic error handling to wget.download
This commit is contained in:
parent
383da79299
commit
967f9142a6
@ -16,7 +16,7 @@
|
|||||||
# -----------------import dependencies----------------------
|
# -----------------import dependencies----------------------
|
||||||
|
|
||||||
|
|
||||||
import wget; import os; import platform; import time
|
import wget; import os; import platform; import time ; import sys
|
||||||
|
|
||||||
import shutil; import tarfile
|
import shutil; import tarfile
|
||||||
|
|
||||||
@ -151,8 +151,7 @@ elif platform.system() == "Windows":
|
|||||||
print("Changed current working directory to '" + str(mcfolder) + "'")
|
print("Changed current working directory to '" + str(mcfolder) + "'")
|
||||||
|
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
print()
|
print(); print("Backing up minecraft install...")
|
||||||
print("Backing up minecraft install...")
|
|
||||||
print("Don't close the window! This'll take a moment...")
|
print("Don't close the window! This'll take a moment...")
|
||||||
|
|
||||||
modfolder = str(mcfolder) + '/mods'
|
modfolder = str(mcfolder) + '/mods'
|
||||||
@ -171,8 +170,11 @@ os.mkdir(str("mods"))
|
|||||||
|
|
||||||
# download mod archive from git repo and extract
|
# download mod archive from git repo and extract
|
||||||
print("Fetching mods...")
|
print("Fetching mods...")
|
||||||
|
try:
|
||||||
wget.download('https://git.sarushinobie.dev/saru/family-minecraft-modpack/releases/download/0.0.1/mods.tar.gz')
|
wget.download('https://git.sarushinobie.dev/saru/family-minecraft-modpack/releases/download/0.0.1/mods.tar.gz')
|
||||||
# this is insane. `wget` the fucking goat. who knew windows package manager was so cool?
|
# this is insane. `wget` the fucking goat. who knew windows package manager was so cool?
|
||||||
|
except:
|
||||||
|
print(); print("[ERR!] Fatal: Download failed! (Is Adolin online?)"); print()
|
||||||
|
|
||||||
extract_tar('mods.tar.gz', 'mods')
|
extract_tar('mods.tar.gz', 'mods')
|
||||||
# ('tarfile', 'directory to extract to')
|
# ('tarfile', 'directory to extract to')
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user