[IronPython] Hosting: passing arguments to scripts?
Christian Muirhead
christian.muirhead at resolversystems.com
Wed Jun 18 17:06:54 CEST 2008
Hey guys -
I'm looking at running Resolver One on IP2B3, and it took a long time to
work out how to pass an argument in to a script to run - it seemed
like I should be able to set the ScriptEngine.Options.Arguments, but
that resulted in an empty sys.argv. In the end I dug around in the
source and found the following, which works:
List argList = new List();
argList.extend(args);
PythonContext context =
(PythonContext)HostingHelpers.GetLanguageContext(engine);
context.SystemState.Dict[SymbolTable.StringToId("argv")] = argList;
There are comments on HostingHelper not really being intended for hosts
- is there a better/less likely to go away method of doing this?
Thanks,
Christian
--
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