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

ValueError: Value 40 is out of range, should be between 0 and 39 #268

Closed
Mennaruuk opened this issue Feb 4, 2022 · 1 comment
Closed

Comments

@Mennaruuk
Copy link

Mennaruuk commented Feb 4, 2022

Hello WoLpH, I hope you are doing well.

Thank you for your amazing project, it's very helpful.

Description

I get the following error:

Traceback (most recent call last):
  File "C:\Users\Menna\Desktop\funny\memes\delete.py", line 66, in <module>
    for url in pbar(data):
  File "C:\Users\Menna\AppData\Local\Programs\Python\Python310\lib\site-packages\progressbar\bar.py", line 550, in __next__
    self.update(self.value + 1)
  File "C:\Users\Menna\AppData\Local\Programs\Python\Python310\lib\site-packages\progressbar\bar.py", line 661, in update
    raise ValueError(
ValueError: Value 40 is out of range, should be between 0 and 39

Code

  1. Save the code below as main.py
    https://pastebin.com/xrm7kZkU

  2. Install waybackpack (GitHub repo)
    pip install waybackpack

  3. Run the following command:
    main.py -u tiredarabwoman -from 20220126

  4. After a minute, you'll get this prompt:
    2 deleted Tweets have been found. Would you like to download them all? Type yes or no.
    Type yes and press Enter. You should get the error above.

Versions

  • Python version: 3.10.0
  • Python distribution/environment: Command Prompt
  • Operating System: Windows 10
  • Package version: 4.0.0

Thank you again.

@wolph
Copy link
Owner

wolph commented Oct 18, 2022

I'm really sorry for the slow response... I didn't see this issue. It seems the pastebin has been removed in the mean time, but I can think of 2 scenarios where this can happen:

  1. An off-by-1 error. A range(40) returns 0 to 39 which does not include 40.
  2. The maximum value grows during iteration. In that case you can disable the error using the max_error=False parameter to the progressbar :)

@wolph wolph closed this as completed Oct 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants