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

AttributeError: type object 'File' has no attribute 'read' #1608

Closed
nirutgupta opened this issue Dec 14, 2020 · 2 comments
Closed

AttributeError: type object 'File' has no attribute 'read' #1608

nirutgupta opened this issue Dec 14, 2020 · 2 comments
Labels
duplicate This issue or pull request already exists

Comments

@nirutgupta
Copy link

nirutgupta commented Dec 14, 2020

isort failing for the version 5.6.4

ERROR: Unrecoverable exception thrown when parsing qaas_liftie/cli/core.py! This should NEVER happen.
If encountered, please open an issue: https://github.com/PyCQA/isort/issues/new
Traceback (most recent call last):
File "/Users/nirut.gupta/workspace/bin/isort", line 8, in
sys.exit(main())
File "/Users/nirut.gupta/workspace/lib/python3.6/site-packages/isort/main.py", line 953, in main
for sort_attempt in attempt_iterator:
File "/Users/nirut.gupta/workspace/lib/python3.6/site-packages/isort/main.py", line 947, in
for file_name in file_names
File "/Users/nirut.gupta/workspace/lib/python3.6/site-packages/isort/main.py", line 100, in sort_imports
**kwargs,
File "/Users/nirut.gupta/workspace/lib/python3.6/site-packages/isort/api.py", line 303, in sort_file
with io.File.read(filename) as source_file:
AttributeError: type object 'File' has no attribute 'read'

Steps to reproduce:
I think any file or directory will work
isort myfile/or/directory

@nirutgupta
Copy link
Author

Ok i think its not the isort version but its the python version that is causing problem. Tried 5.5.0 version as well against python 3.6.0 still the same result.

@timothycrosley timothycrosley added the duplicate This issue or pull request already exists label Dec 30, 2020
@timothycrosley
Copy link
Member

This is a duplicate of: #1593 which is fixed in isort development branch and awaiting release by end of month. More details are on the linked ticket, but the TLDR is that it's caused by a bug in Python 3.6.0 - which has been fixed in Python itself within the 3.6 series so isn't caught by isort's CI/CD which can't reasonably test against all minor releases of Python

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants