From 5488affc7b9ba0a5ed498282f5a9f69d473ed8c2 Mon Sep 17 00:00:00 2001 From: Florian Roth Date: Wed, 15 Jul 2020 15:52:40 +0200 Subject: [PATCH] fix: bug in update function (still used Python 2 functions) --- yarGen.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/yarGen.py b/yarGen.py index a1db822..2a44c78 100644 --- a/yarGen.py +++ b/yarGen.py @@ -22,9 +22,10 @@ import pefile import json import gzip -import urllib +import urllib.request import binascii import base64 +import shutil from collections import Counter from hashlib import sha256 import signal as signal_module @@ -1890,8 +1891,8 @@ def update_databases(): try: for filename, repo_url in REPO_URLS.items(): print("Downloading %s from %s ..." % (filename, repo_url)) - fileDownloader = urllib.URLopener() - fileDownloader.retrieve(repo_url, "./dbs/%s" % filename) + with urllib.request.urlopen(repo_url) as response, open("./dbs/%s" % filename, 'wb') as out_file: + shutil.copyfileobj(response, out_file) except Exception as e: if args.debug: traceback.print_exc()