On Fri, 30 Oct 2009 20:08:28 -0500, Robert Kern wrote:

> Stef Mientki wrote:
...
>> but how do I configure a "properly initialized namespace dict"  (other
>> than my current namespace) ?
> 
> filename = '...'
> ns = dict(
>      __file__=filename,
>      __name__='whatever_you_need_it_to_be', __builtins__=__builtins__,
> )
> execfile(filename, ns)


Or better still, don't use execfile at all, and just use the import 
system the way it's supposed to be used. If you find yourself doing by 
hand what the Python compiler normally does for you, it's a good sign 
that you're probably doing it wrong.



-- 
Steven
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to