forked from hoechenberger/openneuro-py
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ENH: Handle response errors in the file (hoechenberger#80)
Bad-response files can be silently downloaded, see OpenNeuroOrg/openneuro#2690. When doing: ``` $ python -m openneuro download --dataset=ds004107 --include="sub-mind002/ses-01/meg/sub-mind002_ses-01_task-auditory_events.tsv" --target_dir=~/mne_data/ds004107 ``` I get the TSV file with contents: ``` {"error": "an unknown error occurred accessing this file"} ``` So this PR: 1. Adds support for `python -m openneuro` by adding `__main__` 2. Adds support for `--target_dir=~/mne_data/ds004107` by adding `.expanduser().resolve()` on `target_dir` 3. Handles the case where the file contents are JSON-encoded `dict` with a single entry key `'error'`, which I think we can safely treat as an error It's possible that there is some response code earlier that we should be finding/detecting, but I'm not sure where that would be. Co-authored-by: Richard Höchenberger <richard.hoechenberger@gmail.com>
- Loading branch information
1 parent
04364cd
commit 524329f
Showing
3 changed files
with
29 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,4 @@ dist/ | |
build/ | ||
.vscode/ | ||
openneuro_py.egg-info/ | ||
.hypothesis/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
from .openneuro import cli | ||
|
||
if __name__ == '__main__': | ||
cli() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters