[IronPython] upgrading to ip 2b3 in Resolver One

Christian Muirhead christian.muirhead at resolversystems.com
Fri Jun 20 16:17:27 CEST 2008


Christian Muirhead wrote:
> * Another thing I saw here was that you can't set __name__ in a scope 
> when running a script loaded from a source file - that is, this:
> 
> ScriptSource source = engine.CreateScriptSourceFromFile("test.py");
> ScriptScope scope = e.CreateScope();
> scope.SetVariable("__name__", "__main__");
> source.Execute(scope);
> 
> when test.py contains
> 
> print __name__
> 
> 
> prints "test"

Oh, I forgot to say - I got around this using source.ExecuteProgram, 
where __name__ is set correctly.


-- 
Christian Muirhead
Resolver Systems
christian.muirhead at resolversystems.com
We're hiring! http://www.resolversystems.com/jobs/


Resolver Systems Ltd
17a Clerkenwell Road, London EC1M 5RD, UK
VAT No.: GB 893 5643 79 Registered in England and Wales as company 
number 5467329.
Registered address: 843 Finchley Road, London NW11 8NA, UK



More information about the Ironpython-users mailing list