We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I'm writing data to a JSON file in Processing with the saveJSONObject command. I would like to access that JSON file with another program (MAX/MSP) while my sketch is still open. The problem is, MAX is unable to read from the file while my sketch is running. Only after I close the sketch is MAX able to import data from my file.
Is Processing keeping that file open somehow while the sketch is running? Is there any way I can get around this problem?
Answers
It is called file locking.
I looked at the source, and there might be a bug, as saveJSONObject doesn't close the writer. Perhaps I miss something.
Possible workaround (untested): replace the call
with
which does the same operations, but exposes the writer so that we can explicitly close it.
Thanks, your workaround works perfectly.
OK, so I opened an issue: https://github.com/processing/processing/issues/3705
And it has been fixed, it was quick... To be seen in next beta, I suppose.
Great! Thanks for going to the trouble.