运行 print_control_identifiers() 使用 Python 3.5.3 和 pywinauto 0.6.2 时出错
Error while running print_control_identifiers() using Python 3.5.3 and pywinauto 0.6.2
我在 运行 print_control_identifiers()
时收到以下错误
`>>> app['TRACE\u2122 3D Plus'].print_control_identifiers()
Control Identifiers:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\irgfff\AppData\Local\Programs\Python\Python35-32\lib\site- packa
ges\pywinauto\application.py", line 636, in print_control_identifiers
print_identifiers([this_ctrl, ])
File "C:\Users\irgfff\AppData\Local\Programs\Python\Python35-32\lib\site- packa
ges\pywinauto\application.py", line 630, in print_identifiers
print(output)
File "C:\Users\irgfff\AppData\Local\Programs\Python\Python35-32 \lib\encodings\
cp437.py", line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_map)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\u2122' in position
17: character maps to <undefined>
>>>`
我的配置是
`C:\Users\irgfff>pip freeze
comtypes==1.1.3
pypiwin32==219
pywinauto==0.6.2
six==1.10.0`
起初我认为这是一个pywinauto问题,但仍然不确定100%...
尝试在脚本的开头插入以下注释(在第一行,这很重要):
# encoding: utf-16
# the rest of the script
无论如何请告诉贵公司的软件工程师,这个符号不利于可测试性和自动化。 :)
我在 运行 print_control_identifiers()
时收到以下错误`>>> app['TRACE\u2122 3D Plus'].print_control_identifiers()
Control Identifiers:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\irgfff\AppData\Local\Programs\Python\Python35-32\lib\site- packa
ges\pywinauto\application.py", line 636, in print_control_identifiers
print_identifiers([this_ctrl, ])
File "C:\Users\irgfff\AppData\Local\Programs\Python\Python35-32\lib\site- packa
ges\pywinauto\application.py", line 630, in print_identifiers
print(output)
File "C:\Users\irgfff\AppData\Local\Programs\Python\Python35-32 \lib\encodings\
cp437.py", line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_map)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\u2122' in position
17: character maps to <undefined>
>>>`
我的配置是
`C:\Users\irgfff>pip freeze
comtypes==1.1.3
pypiwin32==219
pywinauto==0.6.2
six==1.10.0`
起初我认为这是一个pywinauto问题,但仍然不确定100%... 尝试在脚本的开头插入以下注释(在第一行,这很重要):
# encoding: utf-16
# the rest of the script
无论如何请告诉贵公司的软件工程师,这个符号不利于可测试性和自动化。 :)