Skip to content

Mappings JSON to CSV converter does not work #3

Open
@philipphu

Description

@philipphu

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions