Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
vision
Commits
e757d521
Unverified
Commit
e757d521
authored
Jul 03, 2020
by
Philip Meier
Committed by
GitHub
Jul 03, 2020
Browse files
add error message if Google Drive quota is exceeded (#2321)
Co-authored-by:
Francisco Massa
<
fvsmassa@gmail.com
>
parent
5247f7b6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
0 deletions
+12
-0
torchvision/datasets/utils.py
torchvision/datasets/utils.py
+12
-0
No files found.
torchvision/datasets/utils.py
View file @
e757d521
...
...
@@ -118,6 +118,10 @@ def list_files(root, suffix, prefix=False):
return
files
def
_quota_exceeded
(
response
:
"requests.models.Response"
)
->
bool
:
return
"Google Drive - Quota exceeded"
in
response
.
text
def
download_file_from_google_drive
(
file_id
,
root
,
filename
=
None
,
md5
=
None
):
"""Download a Google Drive file from and place it in root.
...
...
@@ -150,6 +154,14 @@ def download_file_from_google_drive(file_id, root, filename=None, md5=None):
params
=
{
'id'
:
file_id
,
'confirm'
:
token
}
response
=
session
.
get
(
url
,
params
=
params
,
stream
=
True
)
if
_quota_exceeded
(
response
):
msg
=
(
f
"The daily quota of the file
{
filename
}
is exceeded and it "
f
"can't be downloaded. This is a limitation of Google Drive "
f
"and can only be overcome by trying again later."
)
raise
RuntimeError
(
msg
)
_save_response_content
(
response
,
fpath
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment