XingangPan/DragGAN · warning · IOError

Google Drive virus checker nag

Error message

Google Drive virus checker nag

What it means

This is an internal control-flow exception in dnnlib.util.open_url, not a real failure. When Google Drive serves a small interstitial page with a download_warning cookie, the code extracts the real direct-download link, reassigns url, and raises IOError('Google Drive virus checker nag') so the surrounding retry loop re-requests the new URL. You only see it if the retry budget (num_attempts) is exhausted or you catch it yourself.

Source

Thrown at dnnlib/util.py:457

    url_name = None
    url_data = None
    with requests.Session() as session:
        if verbose:
            print("Downloading %s ..." % url, end="", flush=True)
        for attempts_left in reversed(range(num_attempts)):
            try:
                with session.get(url) as res:
                    res.raise_for_status()
                    if len(res.content) == 0:
                        raise IOError("No data received")

                    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 download quota exceeded -- please try again later")

                    match = re.search(r'filename="([^"]*)"', res.headers.get("Content-Disposition", ""))
                    url_name = match[1] if match else url
                    url_data = res.content
                    if verbose:
                        print(" done")
                    break
            except KeyboardInterrupt:
                raise
            except:
                if not attempts_left:
                    if verbose:
                        print(" failed")
                    raise
                if verbose:
                    print(".", end="", flush=True)

View on GitHub (pinned to 336f120ce1)

Solutions

  1. Do not catch this error narrowly — let open_url's internal retry loop handle it; usually nothing to fix
  2. Re-run the command; the retry loop fetches the resolved URL on the next attempt
  3. Download the file manually in a browser and pass a local path to open_url / the script
  4. Increase num_attempts when calling open_url
  5. If hosting weights yourself, avoid Google Drive for large files; use direct HTTP/Dropbox/S3

Example fix

# before
try:
    with dnnlib.open_url(gdrive_url) as f: ...
except IOError as e:
    print(e)  # 'Google Drive virus checker nag' aborts the retry logic

# after
with dnnlib.open_url(gdrive_url) as f: ...  # let internal retries resolve it
# or use a local file:
# with dnnlib.open_url('model.pkl') as f: ...
Defensive patterns

Strategy: retry

Try / catch

try:
    with dnnlib.open_url(url) as f: data = f.read()
except IOError as e:
    if 'virus checker nag' in str(e):
        pass  # internal retry signal — do not treat as fatal; simply re-invoke open_url
    else:
        raise

Prevention

When it happens

Trigger: Calling open_url on a Google Drive URL of a file flagged for large-file virus scanning; the first response is the nag page, the code rewrites url, and the next retry fetches the actual file. Surfaces directly when num_attempts is too low or the retry loop is modified.

Common situations: Downloading community-shared StyleGAN weights hosted on Google Drive; catching IOError broadly around open_url and intercepting this internal signal; GDrive changing its interstitial HTML so the link extraction fails and every attempt re-nags until attempts run out.

Related errors


AI-assisted analysis of XingangPan/DragGAN@336f120ce1 (2026-08-27). Data as JSON: /api/errors/7f352b1faabc9ba3. Report an issue: GitHub.