Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IndexError: tuple index out of range (improve error message) #608

Open
karelbecerra opened this issue Jul 22, 2024 · 2 comments
Open

IndexError: tuple index out of range (improve error message) #608

karelbecerra opened this issue Jul 22, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@karelbecerra
Copy link

karelbecerra commented Jul 22, 2024

Error messaging improvement's: For those of you having this issue (I do think error do not depends on competition)

Command: kaggle competitions download rsna-2024-lumbar-spine-degenerative-classification
Error: IndexError: tuple index out of range
Cause: Wrong or Expired API key
Workaround: Update your local key (~/.kaggle/kaggle.json)
Fix: Print out a diff message so user :-) do not spend 1/2 day finding a fix on google

$ kaggle competitions download rsna-2024-lumbar-spine-degenerative-classification

...

Traceback (most recent call last): File "/home/karel/.local/bin/kaggle", line 8, in sys.exit(main()) File "/home/karel/.local/lib/python3.10/site-packages/kaggle/cli.py", line 54, in main out = args.func(**command_args) File "/home/karel/.local/lib/python3.10/site-packages/kaggle/api/kaggle_api_extended.py", line 1026, in competition_download_cli self.competition_download_files(competition, path, force, File "/home/karel/.local/lib/python3.10/site-packages/kaggle/api/kaggle_api_extended.py", line 989, in competition_download_files url = response.retries.history[0].redirect_location.split('?')[0] IndexError: tuple index out of range

After playing around I found the error is related to wrong/expired API key.

note: You will find some very old similar bugs but are totally unrelated

@stevemessick stevemessick added the bug Something isn't working label Jul 22, 2024
@karelbecerra
Copy link
Author

Forgot to mention environment:

  • Kaggle API 1.6.14
  • Python 3.10.12
  • Ubuntu

How to reproduce: edit your ~/.kaggle/kaggle.json and type some wrong key and execute kaggle competitions download command

@ANotFox
Copy link

ANotFox commented Oct 21, 2024

Agreed, there is another issue #521 which is the same as this. I see the same error and despite the issue being closed (and having retried with a fresh token), I cannot find a workaround.

How were you able to correct this though?

EDIT: It worked on on my third retry. On my first and second retry (directly from the kaggle.json file), it failed to work. On the third, I manually input in the username and key (via echo and read from terminal) and it worked. Interesting workaround, thank you for the thread.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants