[Bf-committers] 2.45 release - py script problems

Toni Alatalo antont at kyperjokki.fi
Fri Aug 24 21:09:05 CEST 2007


Toni Alatalo kirjoitti:
> surely we can put the decimal module somewhere for macs too, if we 
> decide to keep it. of course it may well that the script in question 
> does not actually need it even (i don't know if arbitary precision 
> math is relevant in blender scripts when the internal c code resorts 
> to unprecise floats in the end anyway, but i haven't looked at the 
> script).

well, now (when coming from sauna, actually) i decided to grab the bull 
by the horns and attempt porting the script to not use decimal, but just 
normal floats. guess what? was in the end the simplest coding task i've 
ever done: commenting out the import seems to suffice, i.e. it does not 
seem to use the module at all :p

this is a bit difficult to verify, as the script uses the notorius 'from 
module import *' technique, but i tried all the diff features i could 
figure by pressing all the buttons with different selections and it 
never failed when the decimal module was not imported. also a text 
search in the file does not find Decimal, so at least it is not using 
decimal.Decimal which is the numeric type itself (and i now searched for 
some other things in the module too, no hits there either). so i bet the 
import is there by accident after some dev phase experimentation, and we 
have no real issue here. am cc'ing the author so he could verify.

http://an.org/blender/mesh_unfolder-no_decimal.py is a version from 
where the decimal import line is cut away so ppl and test.

actually i ended up commenting the line just to get errors to find where 
parts of the module are used, and was just suprised to see no errors 
occurred.

BTW, seems to be a really nice script - so great thanks for the author 
anyway! ;)

> ~Toni

same,
having now joined the Knights-who-say-no-to-from_module_import_*! (stivs 
also joined, I propose we make it a bpy coding standard - but is that 
better discussed on the py list to not flood this one)



More information about the Bf-committers mailing list