Create Custom Loader

I'm using code exactly as specified here, and when I end my Prodigy instance (Ctrl-C in Terminal), it throws this error:

Traceback (most recent call last):
  File "src/load_prodigy_texts.py", line 24, in <module>
    print(json.dumps(task))  # dump and print the JSON
KeyboardInterrupt
Exception ignored in: <_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>
BrokenPipeError: [Errno 32] Broken pipe

My annotations appear to be saved correctly, and it could be an innocuous error otherwise, but I just wanted to check if there was some error handling I may be missing, or some on_exit type thing to pay attention to?

I think this is just a side-effect of the stream that's read from stdin being terminated via your keyboard. Should be safe to ignore – or you could probably wrap the line in a try/except block and catch the KeyboardInterrupt.

1 Like