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' #1607

Closed
wmowen opened this issue Dec 9, 2020 · 2 comments
Closed

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

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

Comments

@wmowen
Copy link

wmowen commented Dec 9, 2020

Traceback (most recent call last):
File "/Users/momo/.pyenv/versions/3.6.0/envs/mbtpy/bin/isort", line 11, in
sys.exit(main())
File "/Users/momo/.pyenv/versions/3.6.0/envs/mbtpy/lib/python3.6/site-packages/isort/main.py", line 953, in main
for sort_attempt in attempt_iterator:
File "/Users/momo/.pyenv/versions/3.6.0/envs/mbtpy/lib/python3.6/site-packages/isort/main.py", line 947, in
for file_name in file_names
File "/Users/momo/.pyenv/versions/3.6.0/envs/mbtpy/lib/python3.6/site-packages/isort/main.py", line 100, in sort_imports
**kwargs,
File "/Users/momo/.pyenv/versions/3.6.0/envs/mbtpy/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'

@anirudnits
Copy link
Collaborator

@wmowen can you provide any other details on this issue? like the how you executed isort, config file etc.

@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

3 participants