Skip to content

Commit 2f7aba8

Browse files
YunlkRbb666
authored andcommitted
[tools] fix: replace console emoji in attachconfig.py
scons --attach prints a check mark / cross emoji as status prefix. On Windows the standard output encoding follows the locale code page (936/GBK on a Chinese system), which cannot encode U+2705/U+274C, so Python raises UnicodeEncodeError and the command aborts: UnicodeEncodeError: 'gbk' codec can't encode character '\u2705' File "tools/attachconfig.py", line 18, in GenAttachConfigProject All three commands go through the same function, so --attach=?, --attach=<name> and --attach=default were all unusable on such systems. Replace the emoji with plain ASCII markers and keep the existing ANSI colour codes, which the other scripts under tools/ already use. Refs #11906
1 parent e7c2938 commit 2f7aba8

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

‎tools/attachconfig.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def GenAttachConfigProject(program = None):
1515
if GetOption('attach') == '?':
1616
attachconfig=[]
1717
GetAttachConfig("get",attachconfig,0)
18-
print("\033[32m✅ AttachConfig has: \033[0m")
18+
print("\033[32m[OK] AttachConfig has: \033[0m")
1919
prefix=attachconfig[0]
2020
for line in attachconfig:
2121
temp_prefix=line.split(".", 1)
@@ -32,13 +32,13 @@ def GenAttachConfigProject(program = None):
3232
if os.path.exists(rtconfig__bacakup):
3333
shutil.copyfile(rtconfig__bacakup, rtconfig_file)
3434
os.remove(rtconfig__bacakup)
35-
print("\033[32m✅ Default .config and rtconfig.h recovery success!\033[0m")
35+
print("\033[32m[OK] Default .config and rtconfig.h recovery success!\033[0m")
3636
else:
3737
attachconfig=GetOption('attach')
3838
attachconfig_result=[]
3939
GetAttachConfig("search",attachconfig,attachconfig_result)
4040
if attachconfig_result==[]:
41-
print("❌\033[31m Without this AttachConfig:"+attachconfig+"\033[0m")
41+
print("[ERR]\033[31m Without this AttachConfig:"+attachconfig+"\033[0m")
4242
return
4343
if os.path.exists(config_bacakup)==False:
4444
shutil.copyfile(config_file, config_bacakup)
@@ -49,7 +49,7 @@ def GenAttachConfigProject(program = None):
4949
destination.write(line + '\n')
5050
from env_utility import defconfig
5151
defconfig(Rtt_Root)
52-
print("\033[32m✅ AttachConfig add success!\033[0m")
52+
print("\033[32m[OK] AttachConfig add success!\033[0m")
5353

5454
def GetAttachConfig(action,attachconfig,attachconfig_result):
5555
rtt_root = os.getcwd()

0 commit comments

Comments
 (0)