Search code examples
python-3.xpywinauto

Error while running print_control_identifiers() using Python 3.5.3 and pywinauto 0.6.2


I get the following errors while running the 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>
>>>`

My configuration is

`C:\Users\irgfff>pip freeze
comtypes==1.1.3
pypiwin32==219
pywinauto==0.6.2
six==1.10.0`

Solution

  • First I thought it's a pywinauto issue, but still not sure 100%... Try to insert the following comment at the beginning of your script (at the very first line, it's important):

    # encoding: utf-16
    # the rest of the script
    

    Anyway please tell software engineers in your company that this symbol is not good for testability and automation. :)