[Python-ideas] Python probe: execute code in isolation (subinterpreter?) and get results

Terry Reedy tjreedy at udel.edu
Wed Apr 4 21:05:34 CEST 2012


On 4/4/2012 4:25 AM, anatoly techtonik wrote:

> Story #2: Get settings from user script
>
> Blender uses SCons to automate builds. SCons script is written in
> Python and it uses execfile(filename, globals, locals) to read
> platform specific user script with settings. Unfortunately, execfile()
> is a hack that doesn't treat Python scripts the same way the
> interpreter treats them - for example, globals access will throw
> exceptions - http://bugs.python.org/issue14049

Please stop misrepresenting Python. I clearly explained the issue in 
14049 before closing it. If you did not understand, re-read until you 
do. Trying to get an object via an unbound name (non-existent variable), 
always results in a NameError. There is nothing unique about execfile. 
If Blender's scons script is using execfile wrong (by passing separate 
globals and locals), tell them to fix *their* bug.

-- 
Terry Jan Reedy




More information about the Python-ideas mailing list