Interactive session "forgets&quot...


  • Anonymous

    Hello all, and thanks for your great work.

    I am using Tulip 3.8.0 on Mac Lion. My version is bound to Python 2.7 and I found it here: . I have trouble using the interactive session tab in Tulip as a shell for debugging my code. If I run a script within Tulip, then click on the Interactive Session tab and try to access the objects used in the script, I get an error. For example, if I have a list called userlist in my script and I call


    , I get the following message:

    >>> userlist[0]
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
    NameError: name 'userlist' is not defined
    >>> /code]
    This seems counterintuitive. What am I doing wrong?
  • Hi Alberto,

    The behaviour you describe is normal as when you run a script, the main(graph) function
    is called. So every variable you declare in the body of the main function will be destroyed at the
    end of its execution by the Python Garbage Collector. To prevent that, you can declare the variables you want to inspect
    through the interactive session outside the main function ans they will remain alive after the script execution.

    Hope that it will help