Skip to content
This repository has been archived by the owner on Feb 15, 2024. It is now read-only.

ValueError in random string generator #56

Closed
DarkCat09 opened this issue Oct 5, 2022 · 1 comment
Closed

ValueError in random string generator #56

DarkCat09 opened this issue Oct 5, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@DarkCat09
Copy link
Owner

I've recently run unit tests and have found a bug in generate_aternos_rand function.
It raised a ValueError exception.

To reproduce the bug, just call random string generator in an endless loop:

>>> from python_aternos import AternosConnect
>>> conn = AternosConnect()
>>> while True:
...     a = conn.generate_aternos_rand()
... 
Traceback (most recent call last):
  File "<stdin>", line 2, in <module>
  File "/home/darkcat09/code/python-aternos/python_aternos/atconnect.py", line 128, in generate_aternos_rand
    rand_alphanum = self.convert_num(rand, 36) + ('0' * 17)
  File "/home/darkcat09/code/python-aternos/python_aternos/atconnect.py", line 154, in convert_num
    num = int(sliced)
ValueError: invalid literal for int() with base 10: '7897404767541758e-05'
>>>

The problem is in the generator algorithm.
It was copied from Aternos JavaScript code without any checks.
So, the function must be rewritten.

@DarkCat09 DarkCat09 added the bug Something isn't working label Oct 5, 2022
DarkCat09 added a commit that referenced this issue Oct 5, 2022
@DarkCat09
Copy link
Owner Author

Fixed in 154b2c2

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

No branches or pull requests

1 participant