
March 26, 2013
7:27 p.m.
3. Now the problem. When I run execfile() without parameters, I expect the code inside to be 'virtualized' - isolated from parent process, like in LXC or VirtualBox, but on Python level.
No, the code is not isolated from the parent. When you call execfile only with a filename, globals is set tho the caller's globals, and locals are set to the caller's locals!
Though this is just an educated guess, reading Anatoly's note and Amaury's response leads me to think that Anatoly might be expecting the execfile() function to work more or less like the exec* system calls on Unix systems. Execfile() is more akin to the import statement than the fork/exec paradigm. Skip