Skip to content
New issue

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

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

Already on GitHub? # to your account

Invoking jncep throws a TypeError with python 3.12 #45

Closed
non-Jedi opened this issue Oct 27, 2023 · 2 comments
Closed

Invoking jncep throws a TypeError with python 3.12 #45

non-Jedi opened this issue Oct 27, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@non-Jedi
Copy link

Describe the bug
When invoking jncep with python 3.12, a TypeError is always thrown by import asks:

jncep --help
Traceback (most recent call last):
  File "/home/adam/.venvs/jncep/bin/jncep", line 5, in <module>
    from jncep.jncep import main
  File "/home/adam/.venvs/jncep/lib/python3.12/site-packages/jncep/jncep.py", line 6, in <module>
    from .cli.config import config_manage
  File "/home/adam/.venvs/jncep/lib/python3.12/site-packages/jncep/cli/config.py", line 5, in <module>
    from .. import config, track, utils
  File "/home/adam/.venvs/jncep/lib/python3.12/site-packages/jncep/track.py", line 11, in <module>
    from . import config, core, jncweb, spec, utils
  File "/home/adam/.venvs/jncep/lib/python3.12/site-packages/jncep/core.py", line 17, in <module>
    from . import epub, jnclabs, jncweb, spec, utils
  File "/home/adam/.venvs/jncep/lib/python3.12/site-packages/jncep/jnclabs.py", line 6, in <module>
    import asks
  File "/home/adam/.venvs/jncep/lib/python3.12/site-packages/asks/__init__.py", line 5, in <module>
    from .base_funcs import *
  File "/home/adam/.venvs/jncep/lib/python3.12/site-packages/asks/base_funcs.py", line 8, in <module>
    from .sessions import Session
  File "/home/adam/.venvs/jncep/lib/python3.12/site-packages/asks/sessions.py", line 16, in <module>
    from .request_object import RequestProcessor
  File "/home/adam/.venvs/jncep/lib/python3.12/site-packages/asks/request_object.py", line 31, in <module>
    _BOUNDARY = "8banana133744910kmmr13a56!102!" + str(randint(1e3, 9e3))
                                                       ^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/random.py", line 336, in randint
    return self.randrange(a, b+1)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/random.py", line 301, in randrange
    istart = _index(start)
             ^^^^^^^^^^^^^
TypeError: 'float' object cannot be interpreted as an integer

The issue is that jncep is installed with asks 2.4.12 which doesn't have the commit which fixes this issue. I believe upgrading to asks 3.0.0 should fix the problem, but I'm unsure if there are breaking changes in the asks library between 2.4.12 and 3.0.0.

Expected behavior
jncep should work as it has with previous versions of python.

To Reproduce

  1. Install python 3.12.0.
  2. Create venv: python -m venv jncep-venv
  3. Activate venv: source jncep-venv/bin/activate.fish
  4. Install jncep: pip install jncep
  5. jncep --help

Environment (please complete the following information):

  • OS: Void Linux
  • Python version: 3.12.0
  • JNCEP version: 46
@non-Jedi non-Jedi added the bug Something isn't working label Oct 27, 2023
@non-Jedi
Copy link
Author

I went ahead and forced upgrading to asks 3.0.0 locally (pip install -U asks with venv activated), and jncep seems to be working as expected thus far. My current workflow only uses the jncep epub subcommand though, so there may still be dragons here.

@gvellut
Copy link
Owner

gvellut commented Oct 27, 2023

Thank you for your feedback.

I will update the requirements and test the other commands with the new asks version.

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

No branches or pull requests

2 participants