Isort: UserWarning: Unable to parse file ./foobar.py due to not readable

Created on 4 Jul 2020  路  3Comments  路  Source: PyCQA/isort

I get many of this warning with v5.0.0 (Currently the latest available versions)

bug question

All 3 comments

Hi @jedie,

Thanks for reaching out! Looking at this: https://github.com/jedie/django-user-secrets/commit/84cd1cae003fc934d3de0a5848af6a56e1473c07 I think the reason is that you repleaced --apply with --atomic which do not intend to perform the same function. Apply is now the default so I believe this should be changed to poetry run isort .

I see this too when I use the --atomic switch:

  File "/usr/local/bin/isort", line 8, in <module>
    sys.exit(main())
  File "/opt/isort/lib/python3.7/site-packages/isort/main.py", line 702, in main
    for sort_attempt in attempt_iterator:
  File "/opt/isort/lib/python3.7/site-packages/isort/main.py", line 699, in <genexpr>
    for file_name in file_names
  File "/opt/isort/lib/python3.7/site-packages/isort/main.py", line 98, in sort_imports
    **kwargs,
  File "/opt/isort/lib/python3.7/site-packages/isort/api.py", line 282, in sort_file
    **config_kwargs,
  File "/opt/isort/lib/python3.7/site-packages/isort/api.py", line 138, in sort_stream
    compile(output_stream.read(), content_source, "exec", 0, 1)
io.UnsupportedOperation: not readable

@jedie as @globau mentioned this did highlight an error in atomic support in some contexts, which has been fixed in the latest 5.0.3 patch release.

Thanks!

~Timothy

Was this page helpful?
0 / 5 - 0 ratings

Related issues

johnthagen picture johnthagen  路  3Comments

whg517 picture whg517  路  3Comments

darkclouder picture darkclouder  路  3Comments

cjerdonek picture cjerdonek  路  3Comments

pawamoy picture pawamoy  路  3Comments