[IronPython] Return value from Execute()
Mark Senko
msenko at completegenomics.com
Mon Oct 11 19:40:09 CEST 2010
I'm trying to implement IronPython as a scripting enhancement to our
application.
Part of the design is to have an interactive screen available.
When I call the Execute() method with a command typed in by the user,
an object is returned.
I can easily write this to my window using _pythonRes.ToString() if the
result is a simple type like Int32.
But I've had an impossible time trying to figure out how to iterate over
an IronPython.Runtime.List as returned by a command such as dir() since
it seems to not be enumerable.
Typecasting this object doesn't to an array or a List<> doesn't seem to
work.
Any help would be appreciated.
Being new to IronPython, I'm also a little worried about other types
that I may not be aware of, yet!
This is how I obtain my return value:
ScriptEngine _pengine = Python.CreateEngine();
ScriptSource source = _pengine.CreateScriptSourceFromString(_pythonCmd,
SourceCodeKind.AutoDetect);
var _pythonRes = source.Execute(_pscope);
____
The contents of this e-mail and any attachments are confidential and only for
use by the intended recipient. Any unauthorized use, distribution or copying
of this message is strictly prohibited. If you are not the intended recipient
please inform the sender immediately by reply e-mail and delete this message
from your system. Thank you for your co-operation.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20101011/90856ddd/attachment.html>
More information about the Ironpython-users
mailing list