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

Non-ASCII output can't show in display panel on windows system with chinese language #230

xavierskip opened this issue Dec 9, 2017 · 3 comments


Copy link

@xavierskip xavierskip commented Dec 9, 2017

I use windows 10 and is a chinese user.
I found print any Non-ASCII character can't show in display panel.
python version: 3.6
this is my sample code:

#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import argparse
from gooey import Gooey

def main():
    parser = argparse.ArgumentParser()
    args = parser.parse_args()

if __name__ == "__main__":

when i run it and type in some chinese and execute,I will see warning in terminal like this:

Traceback (most recent call last):
File "C:\Program Files (x86)\Python36-32\lib\site-packages\wx\", line 3163, in
    lambda event: event.callable(*event.args, ** )
File "C:\Program Files (x86)\Python36-32\lib\site-packages\gooey\gui\windows\", line 53, in append_text
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc4 in position 6: invalid continuation byte

I think this is because windows Character Encoding.

活动代码页: 936

I try the same in MacOS and everything works fine.

End I take a patch ingooey\gui\windows\ line 53
than it work.
so,how can I solve the problem general,
modify my program or improve Gooey Library?

Copy link

@xavierskip xavierskip commented Dec 10, 2017

I edit my program add this to solve this problem without modify the library file.

utf8_stdout = os.fdopen(sys.stdout.fileno(), mode='w', encoding='utf-8', closefd=False)
sys.stdout = utf8_stdout


Copy link

@xavierskip xavierskip commented Dec 13, 2017

if you redirect stdout when you package it with PyInstaller without console mode will raise issue, so i have to modify the library source code to pack it under windows system.

Copy link

@chriskiehl chriskiehl commented Sep 16, 2018

Fixed here: #237

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants