Skip to content

Commit 5488aff

Browse files
committed
fix: bug in update function (still used Python 2 functions)
1 parent e99b0e3 commit 5488aff

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

yarGen.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,10 @@
2222
import pefile
2323
import json
2424
import gzip
25-
import urllib
25+
import urllib.request
2626
import binascii
2727
import base64
28+
import shutil
2829
from collections import Counter
2930
from hashlib import sha256
3031
import signal as signal_module
@@ -1890,8 +1891,8 @@ def update_databases():
18901891
try:
18911892
for filename, repo_url in REPO_URLS.items():
18921893
print("Downloading %s from %s ..." % (filename, repo_url))
1893-
fileDownloader = urllib.URLopener()
1894-
fileDownloader.retrieve(repo_url, "./dbs/%s" % filename)
1894+
with urllib.request.urlopen(repo_url) as response, open("./dbs/%s" % filename, 'wb') as out_file:
1895+
shutil.copyfileobj(response, out_file)
18951896
except Exception as e:
18961897
if args.debug:
18971898
traceback.print_exc()

0 commit comments

Comments
 (0)