[Bf-python] Some problems to look at

Willian Padovani Germano wgermano at ig.com.br
Fri Jul 4 04:24:33 CEST 2003


On Thu, 2003-07-03 at 16:52, Michel Selten wrote:
> Hi,
> 
> I've just received 2 bug reports on irc. For complete book keeping,
> I'll just post the problems here.
> 
> * import modules gives errors
>   Execute the following script for example:
> 
>     import Math
>     print dir (Math)
> 
>   Gives the error: 
>     ImportError: No module named Math

It's not Math, it's math ...

But anyway, as you know, importing standard modules: the ImportError
happens if you don't have a full Python installation.  I recall reading 
(bf-committers, I guess) about this problem in OSX because of linking
issues.  The email contained the solution, a Makefile update.

For Python 2.3 we may be able to include standard modules like os and
math in a zip and ship it with Blender.  Until then (and if it is
possible) the solution is to have a full Python installation.  This
happens with any version of Blender, not only the new.

> * Variables are not persistent
> When creating a new variable in the Blender module (say 
> Blender.my_var=0), these vars are persistent amongst various scripts
> until you do a Blender.ReleaseGlobalDict().

Actually the default behavior is to release after each script is run. 
If users want the dict to be preserved, *then* they need to call
Blender.ReleaseGlobalDict(0) (note the argument: 0, for "false").

But there was still a problem with Blender.ReleaseGlobalDict, it only
worked after the second time a script with it was run.  It's fixed now,
so both cases you pointed should work if users correctly set the
behavior.

--
Willian, wgermano at ig.com.br




More information about the Bf-python mailing list