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

Close

How to use the console?!?

Sascha W.
2009-01-12
2013-03-15
  • Sascha W.
    Sascha W.
    2009-01-12

    Hello there,
    OK, I guess this is an easy one cause I'm quite a noob with PyDev for Eclipse...

    How do I use the console for the code I just ran to check the value of variables? Like this little scenario:
    In my code there is:
    a = 10
    I run it. The console terminates.
    I want to type "a" in the console and it should answer "10".

    If this isn't possible - how do I manage to get the values of my variables at a given point in my program?

    Thanks for help, you guys!

     
    • Fabio Zadrozny
      Fabio Zadrozny
      2009-01-12

      For that you need to use the interactive console ( http://pydev.sourceforge.net/console.html and http://fabioz.com/pydev/manual_adv_interactive_console.html ) instead of doing a regular run.

      Cheers,

      Fabio

       
    • Sascha W.
      Sascha W.
      2009-01-12

      alright, thanks! i'll try that... great thing that i can use Python within Eclipse, i love it!

       
    • Sascha W.
      Sascha W.
      2009-01-14

      ok, for some reason it wasn't that easy or I just didn't get it.

      here is my solution (does exactly what I want it to do):
      under Run -> Run Configurations ... -> Python Run - module name -> tab "Arguments"
      I inserted an "-i" under VM arguments.

      Great! Exactly what I wanted to have... I love PyDev. IDLE sucks on a Mac.

       
      • Fabio Zadrozny
        Fabio Zadrozny
        2009-01-14

        That's also an option, but it won't give you code-completion/other niceties that the interactive console from pydev ( http://pydev.sourceforge.net/console.html ) has... That's the 'default' interactive console from python (not from pydev).

        Cheers,

        Fabio

         
      • Fabio Zadrozny
        Fabio Zadrozny
        2009-01-14

        That's also an option, but it won't give you code-completion/other niceties that the interactive console from pydev ( http://pydev.sourceforge.net/console.html ) has... That's the 'default' interactive console from python (not from pydev).

        Cheers,

        Fabio

         
    • Gelli Kis
      Gelli Kis
      2009-01-27

      import sys; print '%s %s' % (sys.executable or sys.platform, sys.version)
      Failed to create input stream: Connection reset

       
    • Gelli Kis
      Gelli Kis
      2009-01-27

      import sys; print '%s %s' % (sys.executable or sys.platform, sys.version)
      Failed to create input stream: Connection reset>>
      >>
      >>import sys; print '%s %s' % (sys.executable or sys.platform, sys.version)
      C:\Python26\python.exe 2.6.1 (r261:67517, Dec  4 2008, 16:51:00) [MSC v.1500 32 bit (Intel)]
      >>
      >>
      >>

       
      • Fabio Zadrozny
        Fabio Zadrozny
        2009-01-27

        Can you report that as a bug? (Is that before the setup? If so, it seems like a race condition: it's trying to access the input stream before it was setup).

        Cheers,

        Fabio