[Bf-python] global dictionary

Stephen Swaney sswaney at swbell.net
Thu Aug 7 19:15:00 CEST 2003


Greetings:

I am in the process of porting an old python
script to run under 2.28 but I am having a
problem with forgetfulness.  Not me, the python
interpreter.

The old version was actually two scripts, an init
script that created a list of interesting stuff and
a FrameChanged script that made use of it.

Under 2.28, they have trouble talking to each other.
In ( at least one of ) the original python implementations
there was a single dictionary for the interpreter.  Now
it looks like each script runs as __main__ with a new
interpreter/dictionary.

By actually reading the API doc (!!!), I notice there is a
Blender.ReleaseGlobalDict(bool) method.  After doing a little
late night experimental computer science, it *seems* that
once this flag is set, it applies to *all* subsequent script
executions.  Or at least until an uncaught exception occurs,
at which time the global dictionary is trashed.

Could someone confirm this?

Also, if there is a better way of maintaining persistant
data between script executions, I would be interested in
hearing about it. ( Using pickle to save/restore the good stuff?)

Thanks.
Stephen

-- 
Stephen Swaney			
sswaney at swbell.net



More information about the Bf-python mailing list