[Ironpython-users] Retrieving Ironpython variables within .NET

Luis Vallejo luis.vallejo at gmail.com
Wed Oct 12 18:04:48 CEST 2011

Hi Guys,

Im new to Ironpython and I was reading the book Ironpython in Action now in
Chapter 15, there is something i want to do but i just cant make it work. I
have the following script

 class Item:

    def __init__(self,value,quality):

        self.value = value

        self.quality = quality

number = 5;

variable = "Goodbye world!"

x = Item(5.0,"Good")

print x.quality

And I want to retrieve the variable "x" from C# change its value and inject
it back to Ironpython the problem I face is that well.. i dont know how. I
have tried with the scope.GetItems() but it returns 0. the only time it
returns the variables is when I Execute the Code, and if its possible I
would like to have it before...

                //Item is of size 0

                var items = _scope.GetItems();


                //After execute items is size 5

                items = _scope.GetItems();


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20111013/95e9d9d0/attachment.html>

More information about the Ironpython-users mailing list