-
Notifications
You must be signed in to change notification settings - Fork 605
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
When reading non-utf8 stdin, emit a more specific warning; for Python 3.7+, use stdin.reconfigure() #1038
Comments
Thanks for this! I have scheduled it for the next release (sometime before April 2020). |
Same problem here. On Ubuntu 18, Python 3.8.5 with this errors.
Full error
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sorry if this issue is closely related to this one that was closed last year:
Change --encoding error text if tool receives input from stdin #898
The fix for that issue was to have csvkit mention
PYTHONIOENCODING
in the message for an encoding error:I've skimmed the relevant parts in the source code but haven't yet dug in too deep, so a couple of quick comments/questions:
1. Have the error message be more explicit when stdin is used?
Is it possible/non-trivial to adjust the warning message to say something specifically about stdin when stdin is the input, especially if the user has set the
-e
flag? I have to admit all this time when piping into a csvkit util and getting an encoding error, I interpreted the messagewith the -e flag or with the PYTHONIOENCODING environment variable
to mean that I should use either-e
or setPYTHONIOENCODING
– i.e. if-e
wasn't working, it was because I hadn't figured out the proper encoding (though I guess I could have interpretedYour file is not "utf-8" encoded
to mean that csvkit wasn't seeing my-e
flag at all)Something like:
2. Automatically configure the encoding for stdin for Pythons 3.7+
I saw that Python 3.7 adds a new
stdin
method to set its encoding:I know the 3.7 userbase is probably still a relative minority, but is it worth adding in conditional behavior to cli.py when
six
detects version > 3.7?The text was updated successfully, but these errors were encountered: