Saving sticky

Is there a way to save a sticky dictionary between rhino sessions?
I have a script where I am creating quite a large dictionary of objects that is being made from a main script and saved within a sc.sticky to pass this information between a number of smaller scripts.
The issue is when I close Rhino this is lost, and I then need to rerun the large script each time I reopen Rhino even though I havent changed anything within the model.
My first thought was to save this as json in the document user text, but the dictionary also contains objects that aren’t easily converted into text.
Thanks

You could serialize the sticky instance in binary format without any need to parse. Check .Net framework documention (MSDN) or (Iron)Python help on how to do this.

Indeed, I like to use the standard pickle module for this:

1 Like

And the shelve module provides an even simpler key : item access method on top of pickle, so very similar to the sticky dictionary.

2 Likes

I somehow missed this! This looks very useful. Cheers Graham :beer:

1 Like