Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

Interactive session "forgets&quot...

Help
Anonymous
2013-04-05
2013-04-20

  • Anonymous
    2013-04-05

    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: http://www.labri.fr/perso/lambert/tulip-3.8.0-Darwin.dmg . 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

    userlist[0]
    

    , 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

    Antoine