Redirect to file fails!
See original GitHub issuefrom __future__ import unicode_literals
import win_unicode_console
win_unicode_console.enable()
print u"ÄäБб"
Works if it’s called from console, but as far as it’s redirected to a file:
print u"ÄäБб"
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-3: ordinal not in range(128)
Issue Analytics
- State:
- Created 8 years ago
- Comments:44 (21 by maintainers)
Top Results From Across the Web
Linux Redirect Error Output To File - nixCraft
Linux Redirect Error Output To File ; Syntax To redirect all output to file. The syntax is as follows to redirect output (stdout)...
Read more >How to redirect stderr to a file [duplicate] - Ask Ubuntu
Redirect stdout to one file and stderr to another file: command > out 2>error · Redirect stdout to a file ( >out ),...
Read more >How to redirect and append both standard output and ...
>>file.txt : Open file.txt in append mode and redirect stdout there. ... if you want to pipe standard output and standard error to...
Read more >Redirecting error from Command Prompt - Visual C++
This article describes redirecting error messages from Command Prompt. ... The command dir file.xxx (where file.xxx does not exist) will ...
Read more >Modify 2>&1 so that output goes to a specific file and any ...
Don't hang, use ampersand & to move on to the next command · Output the data generated by the command to file data.json...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
When I try
py -3 -c "print('α')" > out.txt
, it saves as utf-8 whenPYTHONIOENCODING=utf-8
is set. If you are talking about output to console, then of course it doesn’t work, that’s whywin_unicode_console
exists in the first place.https://docs.python.org/3.6/whatsnew/3.6.html#summary-release-highlights, the “Windows improvements” section.