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
Running the last command in the "Convert_Files_Into_JSON_And_CSV" pipeline the following error occurs: python Mapping_JsonToCsvConverter.py --mapping_path data/mappings
Traceback (most recent call last):
File "Mapping_JsonToCsvConverter.py", line 76, in <module>
sys.exit(main())
File "Mapping_JsonToCsvConverter.py", line 68, in main
writeCsvHeader(delimiter, output, str(behid), str(hierpath.get("path", "")), str(hierpath.get("id", -1)))
UnicodeEncodeError: 'ascii' codec can't encode characters in position 86-87: ordinal not in range(128)
The origin seems to be some Non breaking space characters in the mappings.json file. In my file at least they often occur with the following three hierarchies {"id":1111742,"path":"Lotame Category Hierarchy^Automobiles^Automobile Brands^Asian Made^Mazda^Mazda CX-9 "} {"id":1111771,"path":"Lotame Category Hierarchy^Automobiles^Automobile Brands^Asian Made^Nissan^Nissan Rogue "} {"id":1111687,"path":"Lotame Category Hierarchy^Automobiles^Automobile Brands^European Made^BMW^BMW M-Series "}
This is from the mapping file of the feed ids 72 and 73 (which have the same mapping file according to the API response).
The text was updated successfully, but these errors were encountered:
The quick fix I deployed was changing lines in Mapping_JsonToCsvConverter.py
from
for hierpath in js.get('hierarchy_nodes', []):
writeCsvHeader(delimiter, output, str(behid), str(hierpath.get("path", "")), str(hierpath.get("id", -1)))
to
for hierpath in js.get('hierarchy_nodes', []):
hier = str(hierpath.get("path", ""))
hier = hier.encode('utf-8')
for replacement in [b'\xc3\x82\xc2\xa0', b'\xc3\x83\xc2\xa2a']:
hier = hier.replace(replacement, b'')
hier = str(hier)
writeCsvHeader(delimiter, output, str(behid), hier, str(hierpath.get("id", -1)))
Running the last command in the "Convert_Files_Into_JSON_And_CSV" pipeline the following error occurs:
python Mapping_JsonToCsvConverter.py --mapping_path data/mappings
The origin seems to be some Non breaking space characters in the mappings.json file. In my file at least they often occur with the following three hierarchies
{"id":1111742,"path":"Lotame Category Hierarchy^Automobiles^Automobile Brands^Asian Made^Mazda^Mazda CX-9Â "}
{"id":1111771,"path":"Lotame Category Hierarchy^Automobiles^Automobile Brands^Asian Made^Nissan^Nissan Rogue "}
{"id":1111687,"path":"Lotame Category Hierarchy^Automobiles^Automobile Brands^European Made^BMW^BMW M-Series "}
This is from the mapping file of the feed ids 72 and 73 (which have the same mapping file according to the API response).
The text was updated successfully, but these errors were encountered: