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

Dino Viehland dinov at exchange.microsoft.com
Fri Mar 3 22:09:43 CET 2006


Evaluate can only parse expressions, not statements (and print is a statement).  If you have a statement you'd like to Execute you should use the Execute function on the engine instead.

These correspond w/ Python's exec statement and the eval built-in function.

Do you want to help develop Dynamic languages on CLR? (http://members.microsoft.com/careers/search/details.aspx?JobID=6D4754DE-11F0-45DF-8B78-DC1B43134038)

-----Original Message-----
From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of JoeSox
Sent: Friday, March 03, 2006 1:07 PM
To: Discussion of IronPython
Subject: [IronPython] unexpected token print at <string>:1

Can someone explain why I get this error when calling:

....
tempobject = (object)global_eng.Evaluate("print \"hello\"");
....

---
>>>print "hello"
 unexpected token print at <string>:1
----

I've tried stepping thru:

public static object eval(ICallerContext context, string expression) {
            return eval(context, expression, globals(context));


and I just don't understand why it doesn't return "hello"

Thanks.
--
Joseph
_______________________________________________
users mailing list
users at lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com



More information about the Ironpython-users mailing list