Skip to content

Commit

Permalink
FIX avoid using wget and use urllib
Browse files Browse the repository at this point in the history
  • Loading branch information
mvdoc committed Jun 21, 2024
1 parent 17e20c7 commit d53014f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
11 changes: 7 additions & 4 deletions cortex/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

import h5py
import numpy as np
import wget
import urllib.request

from . import formats
from .database import db
Expand Down Expand Up @@ -1095,10 +1095,13 @@ def download_subject(subject_id='fsaverage', url=None, pycortex_store=None,
print("Downloading from: {}".format(url))
with tempfile.TemporaryDirectory() as tmp_dir:
print('Downloading subject {} to {}'.format(subject_id, tmp_dir))
wget.download(url, tmp_dir)
print('Done downloading')
fnout, _ = urllib.request.urlretrieve(
url,
os.path.join(tmp_dir, f"{subject_id}.tar.gz")
)
print(f'Done downloading to {fnout}')
# Un-tar to pycortex store
with tarfile.open(os.path.join(tmp_dir, subject_id + '.tar.gz'), "r:gz") as tar:
with tarfile.open(fnout, "r:gz") as tar:
print("Extracting subject {} to {}".format(subject_id, pycortex_store))
tar.extractall(path=pycortex_store)

Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,3 @@ pillow
nibabel>=2.1
networkx>=2.1
imageio
wget

0 comments on commit d53014f

Please sign in to comment.