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

solve ANSI escape sequences print error in cmd and powershell #33689

Merged
merged 1 commit into from
Jun 22, 2021

Conversation

thisjiang
Copy link
Contributor

@thisjiang thisjiang commented Jun 21, 2021

PR types

Bug fixes

PR changes

APIs

Describe

参考how-to-print-colored-text-to-the-terminal

\033[开头为ANSI转义代码(ANSI escape sequences),在windows cmd和powershell上直接print('\033[93m\nWarning:\n%s \033[0m' % ('Test'))会乱码,因此sys.platform.lower() == 'win32'时直接不使用ANSI转义代码打印

import sys
if sys.platform.lower() == 'win32':
    warningmsg = "\nWarning:\n%s " % (msg)

若使用os.system("")会导致CI过不了。参考#33656

截屏2021-06-22 上午11 37 47

截屏2021-06-22 上午11 38 12

截屏2021-06-22 上午11 38 34

@paddle-bot-old
Copy link

Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

Copy link
Member

@zhhsplendid zhhsplendid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@wzzju wzzju merged commit 1828426 into PaddlePaddle:develop Jun 22, 2021
@thisjiang thisjiang deleted the solve_ansiterm_print_bug branch June 22, 2021 03:19
lanxianghit pushed a commit that referenced this pull request Jun 22, 2021
…ershell (#33689) (#33715)

解决windows cmd和powershell显示乱码的问题
@thisjiang thisjiang mentioned this pull request Aug 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants