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

codespell fails with uncaught exception on unreadable files #2189

Closed
DimitriPapadopoulos opened this issue Dec 6, 2021 · 2 comments · Fixed by #2196
Closed

codespell fails with uncaught exception on unreadable files #2189

DimitriPapadopoulos opened this issue Dec 6, 2021 · 2 comments · Fixed by #2196
Labels

Comments

@DimitriPapadopoulos
Copy link
Collaborator

$ mkdir -p foo/bar
$ touch foo/bar/file
$ chmod a= foo/bar/file
$ cd foo
$ 
$ codespell 
Traceback (most recent call last):
  File "/home/username/.local/bin/codespell", line 11, in <module>
    load_entry_point('codespell', 'console_scripts', 'codespell')()
  File "/my/path/codespell/codespell_lib/_codespell.py", line 746, in _script_main
    return main(*sys.argv[1:])
  File "/my/path/codespell/codespell_lib/_codespell.py", line 897, in main
    bad_count += parse_file(
  File "/my/path/codespell/codespell_lib/_codespell.py", line 630, in parse_file
    text = is_text_file(filename)
  File "/my/path/codespell/codespell_lib/_codespell.py", line 488, in is_text_file
    with open(filename, mode='rb') as f:
PermissionError: [Errno 13] Permission denied: './bar/file'
$ 
@peternewman peternewman added the bug label Dec 8, 2021
@peternewman
Copy link
Collaborator

Nice find, another warning to add like the missing files.

@DimitriPapadopoulos
Copy link
Collaborator Author

It could fail silently (as it does on files deleted after os.walk()) or emit a warning. In this case, I agree with you: we require a warning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants