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

Ran into ERROR: Unrecoverable exception thrown when parsing <filepath> #2243

Open
pmlk opened this issue Mar 4, 2024 · 0 comments
Open

Ran into ERROR: Unrecoverable exception thrown when parsing <filepath> #2243

pmlk opened this issue Mar 4, 2024 · 0 comments

Comments

@pmlk
Copy link

pmlk commented Mar 4, 2024

While I was refactoring some of my imports I ran into ERROR: Unrecoverable exception thrown when parsing <filepath> This should NEVER happen. If encountered, please open an issue: https://github.com/PyCQA/isort/issues/new

Since it nicely asked to submit an issue, here I am.

I quickly found the issue and was able to fix it manually: one of my imports was missing a space between . and import:

from ..import some_module

Adding the missing space fixed the problem.

Hope it helps someone. Feel free to close if you deem it irrelevant to this library.

Traceback
Traceback (most recent call last):
  File "/Users/pmlk/Library/Caches/pypoetry/virtualenvs/backend-6xSfTYP9-py3.9/bin/isort", line 8, in <module>
    sys.exit(main())
  File "/Users/pmlk/Library/Caches/pypoetry/virtualenvs/backend-6xSfTYP9-py3.9/lib/python3.9/site-packages/isort/main.py", line 1226, in main
    for sort_attempt in attempt_iterator:
  File "/Users/pmlk/Library/Caches/pypoetry/virtualenvs/backend-6xSfTYP9-py3.9/lib/python3.9/site-packages/isort/main.py", line 1210, in <genexpr>
    sort_imports(  # type: ignore
  File "/Users/pmlk/Library/Caches/pypoetry/virtualenvs/backend-6xSfTYP9-py3.9/lib/python3.9/site-packages/isort/main.py", line 93, in sort_imports
    incorrectly_sorted = not api.sort_file(
  File "/Users/pmlk/Library/Caches/pypoetry/virtualenvs/backend-6xSfTYP9-py3.9/lib/python3.9/site-packages/isort/api.py", line 429, in sort_file
    changed = sort_stream(
  File "/Users/pmlk/Library/Caches/pypoetry/virtualenvs/backend-6xSfTYP9-py3.9/lib/python3.9/site-packages/isort/api.py", line 210, in sort_stream
    changed = core.process(
  File "/Users/pmlk/Library/Caches/pypoetry/virtualenvs/backend-6xSfTYP9-py3.9/lib/python3.9/site-packages/isort/core.py", line 422, in process
    parsed_content = parse.file_contents(import_section, config=config)
  File "/Users/pmlk/Library/Caches/pypoetry/virtualenvs/backend-6xSfTYP9-py3.9/lib/python3.9/site-packages/isort/parse.py", line 522, in file_contents
    if "," in import_string.split(just_imports[-1])[-1]:
IndexError: list index out of range
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

1 participant