INNER CODE UNIT · Python

DownloadFile

Ershany/Arcane-Engine · Setup/ArcaneUtils.py:24

def DownloadFile(url, filepath):
	path = filepath
	filepath = os.path.abspath(filepath)
	os.makedirs(os.path.dirname(filepath), exist_ok=True)

	if type(url) is list:
		for url_option in url:
			print("Downloadng", url_option)
			try:
				DownloadFile(url_option, filepath)
				return
			except urllib.error.URLError as e:
				print(f"URL Error encountered: {e.reason}. Proceeding with backup...\n\n")
				os.remove(filepath)
				pass
			except urllib.error.HTTPError as e:
				print(f"HTTP Error  encountered: {e.code}. Proceeding with backup...\n\n")
				os.remove(filepath)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…