wkentaro / gdown

Google Drive Public File Downloader when Curl/Wget Fails
MIT License
4.3k stars 350 forks source link

AttributeError: 'NoneType' object has no attribute 'groups' #333

Open drbeane opened 8 months ago

drbeane commented 8 months ago

Provide environment information

/usr/local/bin/python Python 3.10.12 gdown 4.7.3

What OS are you using?

Windows 10

Describe the Bug

I am attempting to use gdown to download the ipynb file for a Colab notebook. I am running the code from a different Colab notebook and am getting the error below.

This seems to be the same issue discussed here: https://github.com/wkentaro/gdown/issues/291

Until today, downgrading to gdown version 4.6.3 fixed the issue, but that seems to no longer be the case.

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
[<ipython-input-8-db6fed3c0bd6>](https://localhost:8080/#) in <cell line: 1>()
----> 1 notebook_name = gdown.download(id=notebook_id, quiet=True)

[/usr/local/lib/python3.10/dist-packages/gdown/download.py](https://localhost:8080/#) in download(url, output, quiet, proxy, speed, use_cookies, verify, id, fuzzy, resume, format, user_agent)
    248         )
    249         m = re.search(r"filename\*=UTF-8''(.*)", content_disposition)
--> 250         filename_from_url = m.groups()[0]
    251         filename_from_url = filename_from_url.replace(osp.sep, "_")
    252     else:

AttributeError: 'NoneType' object has no attribute 'groups'

Expected Behavior

The notebook should be downloaded.

To Reproduce

No response

nmdaman commented 8 months ago

I am having this same issue with a CoLab notebook. Downgrading to previous versions did not help. This code worked a few days ago.

Error:

    'NoneType' object has no attribute 'groups'

To report issues, please visit https://github.com/wkentaro/gdown/issues.
---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
[<ipython-input-20-9b023bc3d8e1>](https://u9ujg5vsr7-496ff2e9c6d22116-0-colab.googleusercontent.com/outputframe.html?vrz=colab_20240306-060117_RC00_613175604#) in <cell line: 5>()
      3 get_ipython().system('gdown 1v5QrCU2JgoRiPDnT2k-dw1-YW9w-FZFw')
      4 import numpy as np  #this module needed to be loaded for the csv file load
----> 5 EPSCs = np.fromfile('/content/EPSCs.txt',dtype=float)
      6 with open("/content/EPSCs.txt") as thecsvfile:
      7   EPSCs = np.loadtxt(thecsvfile, delimiter=",")

FileNotFoundError: [Errno 2] No such file or directory: '/content/EPSCs.txt'
RobLins12 commented 8 months ago

I had this trouble too... so i upgraded gdown by using "pip install --upgrade gdown" and then the code started working again

DmStepankov commented 8 months ago

Upgrading gdown with the above method to version 5.1.0 seems solve the problem in Google Colab

bmox commented 8 months ago

Run this on Google Colab !pip install --upgrade gdown

aakhmetz commented 8 months ago

it worked for me

steluis commented 8 months ago

I had this trouble too... so i upgraded gdown by using "pip install --upgrade gdown" and then the code started working again

You saved me !!

alexander-py commented 8 months ago

Not the case here (also on Google Colab).

Downgrading does not work anymore. Neither does upgrading.

filiptrplan commented 8 months ago

Not the case here (also on Google Colab).

Downgrading does not work anymore. Neither does upgrading.

Same here... Was working until a day ago on 4.6.1 but now no versions work.

bmox commented 8 months ago

In Google colab Restart the session and upgrade the gdown module.

On Sat, Mar 9, 2024, 3:13 AM Filip Trplan @.***> wrote:

Not the case here (also on Google Colab).

Downgrading does not work anymore. Neither does upgrading.

Same here... Was working until a day ago on 4.6.1 but now no versions work.

— Reply to this email directly, view it on GitHub https://github.com/wkentaro/gdown/issues/333#issuecomment-1986461355, or unsubscribe https://github.com/notifications/unsubscribe-auth/AO7ZDCFMTA375BZQGFDG563YXIWIHAVCNFSM6AAAAABELMJX72VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOBWGQ3DCMZVGU . You are receiving this because you commented.Message ID: @.***>

alexander-py commented 8 months ago

Seems its working as of today :)

weigary commented 8 months ago

I see this error in the Colab notebook when downloading a folder:

import gdown
url = "https://drive.google.com/drive/folders/1BO_dyz-p65qhBRRMRA4TbZ8qW4rB99JZ"
gdown.download_folder(url, use_cookies=False)

OR

url = "https://drive.google.com/drive/folders/1BO_dyz-p65qhBRRMRA4TbZ8qW4rB99JZ"
! gdown --folder ${url}

The error persists even if I upgraded to the latest version gdown=5.1.0.