You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is being done on a Windows machine in a PowerShell session. See repro and error below:
$env:UA_PARSER_YAML = "C:\\Temp\\regexes.yaml"
>>> from ua_parser import user_agent_parser
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\mark.depalma\Desktop\Projects\Intune\Scripts\DynamicRedirector\uatestenv\lib\site-packages\ua_parser\user_agent_parser.py", line 481, in <module>
regexes = yaml.load(fp, Loader=SafeLoader)
File "C:\Users\mark.depalma\Desktop\Projects\Intune\Scripts\DynamicRedirector\uatestenv\lib\site-packages\yaml\__init__.py", line 81, in load
return loader.get_single_data()
File "C:\Users\mark.depalma\Desktop\Projects\Intune\Scripts\DynamicRedirector\uatestenv\lib\site-packages\yaml\constructor.py", line 49, in get_single_data
node = self.get_single_node()
File "yaml\_yaml.pyx", line 673, in yaml._yaml.CParser.get_single_node
File "yaml\_yaml.pyx", line 687, in yaml._yaml.CParser._compose_document
File "yaml\_yaml.pyx", line 731, in yaml._yaml.CParser._compose_node
File "yaml\_yaml.pyx", line 845, in yaml._yaml.CParser._compose_mapping_node
File "yaml\_yaml.pyx", line 729, in yaml._yaml.CParser._compose_node
File "yaml\_yaml.pyx", line 806, in yaml._yaml.CParser._compose_sequence_node
File "yaml\_yaml.pyx", line 731, in yaml._yaml.CParser._compose_node
File "yaml\_yaml.pyx", line 845, in yaml._yaml.CParser._compose_mapping_node
File "yaml\_yaml.pyx", line 694, in yaml._yaml.CParser._compose_node
File "yaml\_yaml.pyx", line 858, in yaml._yaml.CParser._parse_next_event
File "yaml\_yaml.pyx", line 867, in yaml._yaml.input_handler
File "C:\Program Files\Python39\lib\encodings\cp1252.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x8d in position 461: character maps to <undefined>
When manually stepping through code I saw that the file was being opened using 'cp1252' encoding by default. Adjusting the code so that the open handle is created as binary resolves the issue.
Line 480 of user_agent_parser.py with fix: with open(UA_PARSER_YAML, 'rb') as fp:
The text was updated successfully, but these errors were encountered:
This is being done on a Windows machine in a PowerShell session. See repro and error below:
When manually stepping through code I saw that the file was being opened using 'cp1252' encoding by default. Adjusting the code so that the open handle is created as binary resolves the issue.
Line 480 of user_agent_parser.py with fix:
with open(UA_PARSER_YAML, 'rb') as fp:
The text was updated successfully, but these errors were encountered: