Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
On some file read errors, the file name is not printed. Like:
Traceback (most recent call last): File "/home/bob/.local/bin/pipreqs", line 8, in <module> sys.exit(main()) File "/home/bob/.local/lib/python3.7/site-packages/pipreqs/pipreqs.py", line 488, in main init(args) File "/home/bob/.local/lib/python3.7/site-packages/pipreqs/pipreqs.py", line 418, in init follow_links=follow_links) File "/home/bob/.local/lib/python3.7/site-packages/pipreqs/pipreqs.py", line 115, in get_all_imports contents = f.read() File "/usr/lib/python3.7/codecs.py", line 322, in decode (result, consumed) = self._buffer_decode(data, self.errors, final) UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe4 in position 65: invalid continuation byte
Including file read inside the Try gives out better message:
ERROR: Failed on file: /home/bob/foofaa/foofaaservice.py Traceback (most recent call last): File "/home/bob/.local/bin/pipreqs", line 8, in <module> sys.exit(main()) File "/home/bob/.local/lib/python3.7/site-packages/pipreqs/pipreqs.py", line 488, in main init(args) File "/home/bob/.local/lib/python3.7/site-packages/pipreqs/pipreqs.py", line 418, in init follow_links=follow_links) File "/home/bob/.local/lib/python3.7/site-packages/pipreqs/pipreqs.py", line 131, in get_all_imports raise exc File "/home/bob/.local/lib/python3.7/site-packages/pipreqs/pipreqs.py", line 116, in get_all_imports contents = f.read() File "/usr/lib/python3.7/codecs.py", line 322, in decode (result, consumed) = self._buffer_decode(data, self.errors, final) UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe4 in position 65: invalid continuation byte