Debugging errors in dumped json


With our deployed instance of our Prodigy application, we noticed the JSON library was non-functional this morning.

When testing locally, it seems that even though the prodigy version remains 1.15.6 in both instances, installing directly from the download endpoint the python JSON library breaks down, however installing using the whl file, everything works as it did last week.

I've been asked by our CICD team to raise an issue with support to help us understand why this might be happening. The deployed app service was confirmed working last week when installing directly from the prodigy website. We haven't updated the application until today, when it broke.

Hi @kwaddle ,

Sorry to hear you're having installation problems. Python environments can only have one copy of each library, so sometimes the dependency graph can change as versions of other libraries are released. This means the same package installed at a different time can result in a different environment.

One way to address this is to compute an exactly-pinned requirements.txt file for your deployment, so you know you're always deploying the same thing. Prodigy itself can't provide exact pins, because we want to declare we're compatible with a range of versions so that we can coexist with other libraries.

All that said, the idea of breaking the built-in json library seems very strange. Could you clarify that at all? We don't monkeypatch anything, and I can't see what we could interfere with as a side-effect.

Hi @honnibal,

Thanks so much for your quick reply!

I understand what you're saying, and it definitely makes sense.

At the moment we're wanting to programmatically export our saved annotations to a json file. In order to do this we're importing the basic python library (import json), nothing special. We then use the db functions to get the annotations and json.dump them into a file in our mounted directory.

As of this morning we're getting a strange error SyntaxError: Unexpected token 'I', "Internal S"... is not valid JSON ... which from my googling adventures seems to occur when there's a version conflict of some sort. This token it's printing isn't even in the text we're trying to dump into the file.

I definitely appreciate the suggestion to pin a specific version. I'm honestly rather vexxed by this, as it seems such a strange thing to see after not changing anything until this morning. :frowning: and even then all we did change was the path to the file share.

Ah that error will surely refer to a syntax error within your exported annotations. Somehow the file you're saving is not valid jsonl. Could you have a look at the file and see which line might not be valid? If you write a small script to iterate over the lines and load them in you should be able to see what's wrong.

Yeah, I'm starting to come to that conclusion myself.

I do apologize for cluttering the support boards with this. It's suddenly stopped working as well when installing from the whl file. The strange thing is this is the same test file I've been using throughout development, and have never seen this happen with this file before now :frowning:

sorry again

No problem! Hope you can find the problem quickly from here :slight_smile:

I'll change the title so things are easier to search

1 Like