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
Vs Code fails to get the encoding of the file #26227
Comments
From what I understand here, VS code is not passing the A minimal reproduction would be a pre-commit hook which does the following: #!/usr/bin/env python
import io
# io.open triggers an encoding lookup
with io.open('/dev/null') as f:
f.read() Simply write that to |
This is an issue of pre-commit |
@joaomoreno I encourage you to reconsider. My reproduction above does not involve the framework, just vanilla git, vanilla python, and vanilla vscode. Commit with that set up works fine for me outside of vscode but crashes with the LookupError listed above. (the small python script also works just fine outside). I think you may be confused about my poor choice in naming (heh), pre-commit (the framework) is named after the built in git hook by the same name. |
What would a fix in VS Code look like? |
I'm not entirely sure without analyzing the problem more. My guess is VS Code needs to pass along the |
OK I decided to look into this, here's my conclusions: I changed the pre-commit hook to print the environment it receives: import os
for k, v in sorted(os.environ.items()):
print('{!r}: {!r}'.format(k, v))
import io
print('ohai from pre-commit')
io.open('/dev/null').read()
The problem is the
The I've submitted a PR here: #26412 |
Thanks for taking the time to look into this. 🍻 |
@joaomoreno hopefully this will land in next version of vscode |
Look at the following issue pre-commit/pre-commit#519
VS Code has issue recognising the encoding of pre-commit file
Steps to Reproduce:
The text was updated successfully, but these errors were encountered: