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

Fix ValueError crash #5800

Merged
merged 1 commit into from
Nov 10, 2016
Merged

Fix ValueError crash #5800

merged 1 commit into from
Nov 10, 2016

Conversation

Gobberwart
Copy link
Contributor

@Gobberwart Gobberwart commented Nov 9, 2016

Short Description:

FIxes bot crash introduced by PR #5704.

ValueError, "non-integer arg 1 for randrange()"

Error is caused by trying to pass FLOATs to the randrange function instead of INTs.

Does not happen when reconnecting_timeout in config is set to default 15, as 15 * 0.8 = 12, and 15 * 1.2 = 18, so both are INTs, however if reconnecting_timeout is changed from the default, this error occurs.

ValueError, "non-integer arg 1 for randrange()"
@mention-bot
Copy link

@Gobberwart, thanks for your PR! By analyzing the history of the files in this pull request, we identified @mudmud2k, @douglascamata and @TheSavior to be potential reviewers.

@Gobberwart Gobberwart merged commit ac7f30e into PokemonGoF:dev Nov 10, 2016
@mudmud2k
Copy link
Contributor

Instead of random.randint it also could use random.uniform, so there is no need for helping variables or an int converting...

Sorry that I forgot to add the int() and missed the int/float-error, it should had been:

wait_time = randint(int(config.reconnecting_timeout * 0.8 * 60), int(config.reconnecting_timeout * 1.2 * 60))

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

Successfully merging this pull request may close these issues.

4 participants