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
[EMAIL PROTECTED]
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
_______________________________________________
Users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to