Saving StorageManager items to disk *without* saving .toe file

I am trying to understand if StorageManager is the right way of saving some values that I need to be persistent. On the StorageManager Class wiki it reads:

The items defined in this list will be created in your Component’s Storage dictionary, and will thus be saved on disk when your .toe is saved.

This is fine if I’m actively working on the .toe, and saving. However, for installations this might be a bit more problematic. Let’s say I need to save some values to use in case of catastrophic failure because I want my system to reboot in the last state it was when it originally crashed.

Using StorageManager would mean I would have to find a way to save the entirety of the .toe file everytime I need to update the saved state of the system, which doesn’t seem like the right approach for this.

I have thought about saving the important information to an external .json file, and loading that in case of reboot after failure, but I was wondering if there was a more elegant way of solving this.

Yeah StorageManager is not made for auto–backup type situations. Maybe the most real-time TouchDesigner based method would be to use a text or table DAT with Sync To File on. That could get corrupted if you crash, I suppose, but I’m not sure if any system saves you from that potential.

You might want to make a little python extension to load/save to json that you can call as needed.

Yeah definitely there are a ton of pure Python solutions you could do as well.

Thanks @Ivan and @amazingrobot! I will follow the json path :slight_smile: