Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX avoid using wget and use urllib #542

Merged
merged 1 commit into from
Jun 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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