Skip to content

Commit

Permalink
Proper handling of 'Google Drive quota exceeded' error.
Browse files Browse the repository at this point in the history
  • Loading branch information
tkarras committed Feb 6, 2019
1 parent ac8f2a8 commit 9a9707f
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions dnnlib/util.py
Expand Up @@ -367,11 +367,15 @@ def open_url(url: str, cache_dir: str = None, num_attempts: int = 10, verbose: b
if len(res.content) == 0:
raise IOError("No data received")

if "download_warning" in res.headers.get("Set-Cookie", "") and len(res.content) < 8192:
links = [html.unescape(link) for link in res.content.decode("utf-8").split('"') if "export=download" in link]
if len(links) == 1:
url = requests.compat.urljoin(url, links[0])
raise IOError("Google Drive virus checker nag")
if len(res.content) < 8192:
content_str = res.content.decode("utf-8")
if "download_warning" in res.headers.get("Set-Cookie", ""):
links = [html.unescape(link) for link in content_str.split('"') if "export=download" in link]
if len(links) == 1:
url = requests.compat.urljoin(url, links[0])
raise IOError("Google Drive virus checker nag")
if "Google Drive - Quota exceeded" in content_str:
raise IOError("Google Drive quota exceeded")

match = re.search(r'filename="([^"]*)"', res.headers.get("Content-Disposition", ""))
url_name = match[1] if match else url
Expand Down

6 comments on commit 9a9707f

@WattZhang
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how to fix the "Google Drive quota exceeded"?

@albusdemens
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also got the same error... is it an issue on my side or on yours? @WattZhang please let me know if you found a way to fix this ;-)

@WattZhang
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

their google drive is down,just download the file by browser,then use the local file,have fun

@albusdemens
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed! Thanks for the suggestion.

@Harry-KIT
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi guys. I am also trying to do that. But my plan is to train custom dataset. So do i need this file from Google drive even though i want to do custom dataset?

@Harry-KIT
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I appreciate your answers no matter what you will~

Please sign in to comment.