Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

Active Console

hill
2009-04-28
2013-03-15
  • hill
    hill
    2009-04-28

    Is there a way to associate a console to a module, so that variables defined in the module can be accessed and used interactively?  I know in other IDEs (PyScripter) your variables are saved and you can access, plot, re-define, etc. 

    I'm new to Python, trying to break from Matlab.  Any help, would be greatly appreciated.

     

     
    • Fabio Zadrozny
      Fabio Zadrozny
      2009-04-29

      You can start the interactive console and do a from my.module import * to have the tokens available ( http://pydev.sourceforge.net/console.html ).

      In pydev extensions you can use ctrl+alt+enter to do it easier... (see http://fabioz.com/pydev/manual_adv_interactive_console.html )

      Cheers,

      Fabio

       
    • hill
      hill
      2009-04-29

      Thanks for getting back to me.  That works in terms of accessing the variables, but I noticed another bug.  If I have a
      plot command in the module, it will run the script including the plot, but Eclipse will freeze until I close the figure.  Is there anyway around that?

      Also, are there any 'delete' or 'clear' commands to erase some/all variables while working interactively?

       
      • Fabio Zadrozny
        Fabio Zadrozny
        2009-04-29

        Well, actually, there's no way around it... When you issue a command to python, the shell will only respond when an answer is gotten (so, if you open a modal dialog, it'll only respond when it finishes -- just like you'd expect from any other shell). You could work around that in your own code (not sure which API you're using, but if you don't open it as modal, it should work).

        To remove a variable from the namespace, you can do: 'del varName'. To erase all you could do: locals().clear().

        Cheers,

        Fabio

         
    • ricitron
      ricitron
      2009-05-14

      In the MacPython IDLE there is always an active shell, so when you run a program you can always access the variables after it is finished running. I have used the eclipsed-based workspace for IDL and it also includes a command line where you can access variables after a run.

      Is there anyway to have a permanent active shell with pydev?

      Thanks.