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

Suggested fix for "cannot import name 'JSONDecodeError'" #77

Closed
edrozenberg opened this issue Jan 9, 2023 · 1 comment
Closed

Suggested fix for "cannot import name 'JSONDecodeError'" #77

edrozenberg opened this issue Jan 9, 2023 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@edrozenberg
Copy link

Describe the bug
When running the cli utility version 20221209_b864626, seeing an error due to a missing py import.

To Reproduce
twspace_dl

Expected behavior
No error

Output

Traceback (most recent call last):
  File "/usr/bin/twspace_dl", line 5, in <module>
    from twspace_dl.__main__ import main
  File "/usr/lib64/python3.9/site-packages/twspace_dl/__init__.py", line 3, in <module>
    from .twspace import Twspace
  File "/usr/lib64/python3.9/site-packages/twspace_dl/twspace.py", line 10, in <module>
    from requests.exceptions import JSONDecodeError
ImportError: cannot import name 'JSONDecodeError' from 'requests.exceptions' (/usr/lib64/python3.9/site-packages/requests/exceptions.py)

Desktop (please complete the following information):

  • OS: Slackware64 Linux 15.0
  • Version: 20221209_b864626
  • Installation method: pip3 from github source

Additional context
Possible fix:

modify twspace.py as follows:

Delete:
from requests.exceptions import JSONDecodeError

Add:
from json import JSONDecodeError

I don't know if this is the "right fix" but it seems to work.

@edrozenberg edrozenberg added the bug Something isn't working label Jan 9, 2023
@edrozenberg edrozenberg changed the title Suggested fix for cannot import name 'JSONDecodeError' Suggested fix for "cannot import name 'JSONDecodeError'" Jan 9, 2023
@Ryu1845
Copy link
Collaborator

Ryu1845 commented Jan 9, 2023

Actually, I don't even use that import (it was used in an intermediate step while solving #62). I can just delete it

@Ryu1845 Ryu1845 closed this as completed in 4db855a Jan 9, 2023
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

2 participants