Feeding Ninja output through stdin turned out to be leading to a UnicodeDecodeError. This recodes the input to a format the script can handle.