[IronPython] unexpected token print at <string>:1

JoeSox joesox at gmail.com
Fri Mar 3 23:12:16 CET 2006


On 3/3/06, Szymon Kobalczyk <s.kobalczyk at softwaremind.pl> wrote:
> JoeSox napisał(a):
> > Ok, so my next question is
> >
> > global_eng.Execute("print \"hello\"");
> >
> > does not return a Stmt.  How do I access it's value?
> > If I am not mistaken, the return statement is held in the Stmt's value.
> >
> >
> In Python the value of last statement is stored in special '_' variable.
> So to read it just use:
>
> engine.GetVariable("_");
>
> Note that if you precompile your scripts you must set the last argument
> of Compile method to true in order for this to work:
>
> engine.Compile(script, true);

I must still be missing something because I received:

[System.MissingMemberException]	{"'module' object has no attribute
'_'"}	System.MissingMemberException

exception.

I am using IronPython 1x beta3
--
Joseph


More information about the Ironpython-users mailing list