Kaggle / kaggle-api

Official Kaggle API
Apache License 2.0
6.01k stars 1.06k forks source link

Kaggle Can't download dataset using Kaggle CLI #522

Closed raspipy closed 5 months ago

raspipy commented 7 months ago

i've been trying to download some datasets using the Kaggle CLI yesterday that went perfect but today it all of a sudden decided to break, i used kaggle datasets download -d marquis03/plants-classification And it gave me the result

`Traceback (most recent call last): File "", line 198, in _run_module_as_main File "", line 88, in _run_code File "C:\Users\janjulius.vannieuwen\AppData\Local\Programs\Python\Python312\Scripts\kaggle.exe__main__.py", line 7, in File "C:\Users\janjulius.vannieuwen\AppData\Local\Programs\Python\Python312\Lib\site-packages\kaggle\cli.py", line 70, in main out = args.func(**command_args) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\janjulius.vannieuwen\AppData\Local\Programs\Python\Python312\Lib\site-packages\kaggle\api\kaggle_api_extended.py", line 1493, in dataset_download_cli self.dataset_download_files(dataset, File "C:\Users\janjulius.vannieuwen\AppData\Local\Programs\Python\Python312\Lib\site-packages\kaggle\api\kaggle_api_extended.py", line 1447, in dataset_download_files self.download_file(response, outfile, quiet, not force) File "C:\Users\janjulius.vannieuwen\AppData\Local\Programs\Python\Python312\Lib\site-packages\kaggle\api\kaggle_api_extended.py", line 1834, in download_file size = int(response.headers['Content-Length'])


  File "C:\Users\janjulius.vannieuwen\AppData\Local\Programs\Python\Python312\Lib\site-packages\urllib3\_collections.py", line 260, in __getitem__
    val = self._container[key.lower()]
          ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
KeyError: 'content-length'`

Does anyone know how to fix?
Jonghyun-An commented 6 months ago

I think it's because the token has expired or changed and is not currently a valid token. Get a new token from your account, put it in the ~/.kaggle/kaggle.json path, and try again!

justinrey08 commented 6 months ago

I think it's because the token has expired or changed and is not currently a valid token. Get a new token from your account, put it in the ~/.kaggle/kaggle.json path, and try again!

Thanks for this! This definetely helped!

Philmod commented 5 months ago

Thanks for reporting, I have a fix for this bug that will go out today with the version 1.6.1.