Evaluate function in DLR hosting

Nov 2, 2009 at 2:51 PM

Hi,

I'm currently fixing some code that used IronPython 1 and now uses IronPython 2.  of course I noticed that the DLR hosting interface has changed and now uses Microsoft.Scripting and Microsoft.Scripting.Hosting packages.

My problem is that I have an old interface command: "python_engine.Evaluate(string_command)" that returns an Object, and I can't find the equivalent in the new Hosting API.

Could you please give any advice or help,

Thanks in advance,

Matt

Coordinator
Nov 2, 2009 at 4:34 PM

You can do engine.Execute(‘2+2’) and it’ll auto-detect that it’s an expression and return the value.

From: matan504 [mailto:notifications@codeplex.com]
Sent: Monday, November 02, 2009 7:51 AM
To: Dino Viehland
Subject: Evaluate function in DLR hosting [dlr:73825]

From: matan504

Hi,

I'm currently fixing some code that used IronPython 1 and now uses IronPython 2. of course I noticed that the DLR hosting interface has changed and now uses Microsoft.Scripting and Microsoft.Scripting.Hosting packages.

My problem is that I have an old interface command: "python_engine.Evaluate(string_command)" that returns an Object, and I can't find the equivalent in the new Hosting API.

Could you please give any advice or help,

Thanks in advance,

Matt

Read the full discussion online.

To add a post to this discussion, reply to this email (dlr@discussions.codeplex.com)

To start a new discussion for this project, email dlr@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com

Nov 2, 2009 at 5:01 PM
dinov wrote:

You can do engine.Execute(‘2+2’) and it’ll auto-detect that it’s an expression and return the value.

 

how do i return an object from that?

this Evaluate command is in a C# function that i wrote, and i need it to return an object.

 Thanks for the fast reply!

Coordinator
Nov 2, 2009 at 5:19 PM

engine.Execute(…) returns an object already – so you can just do ‘return engine.Execute(“2+2”);‘

From: matan504 [mailto:notifications@codeplex.com]
Sent: Monday, November 02, 2009 10:02 AM
To: Dino Viehland
Subject: Re: Evaluate function in DLR hosting [dlr:73825]

From: matan504

dinov wrote:

You can do engine.Execute(‘2+2’) and it’ll auto-detect that it’s an expression and return the value.

how do i return an object from that?

this Evaluate command is in a C# function that i wrote, and i need it to return an object.

Thanks for the fast reply!

Read the full discussion online.

To add a post to this discussion, reply to this email (dlr@discussions.codeplex.com)

To start a new discussion for this project, email dlr@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com

Nov 2, 2009 at 5:32 PM
dinov wrote:

engine.Execute(…) returns an object already – so you can just do ‘return engine.Execute(“2+2”);‘

 

I see. ok i'll try that.

Thanks a lot!