add basic error handling to wget.download

This commit is contained in:
Obie Hinojosa 2025-05-28 17:36:27 -05:00
parent 383da79299
commit 967f9142a6

View File

@ -16,7 +16,7 @@
# -----------------import dependencies----------------------
import wget; import os; import platform; import time
import wget; import os; import platform; import time ; import sys
import shutil; import tarfile
@ -151,8 +151,7 @@ elif platform.system() == "Windows":
print("Changed current working directory to '" + str(mcfolder) + "'")
time.sleep(1)
print()
print("Backing up minecraft install...")
print(); print("Backing up minecraft install...")
print("Don't close the window! This'll take a moment...")
modfolder = str(mcfolder) + '/mods'
@ -171,8 +170,11 @@ os.mkdir(str("mods"))
# download mod archive from git repo and extract
print("Fetching mods...")
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?
try:
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?
except:
print(); print("[ERR!] Fatal: Download failed! (Is Adolin online?)"); print()
extract_tar('mods.tar.gz', 'mods')
# ('tarfile', 'directory to extract to')