Iban Cereijo
Iban Cereijo

Reputation: 1675

Send multiple line code to PyDev interactive console at the context of a breakpoint

I'm using Eclipse Luna 4.4.0 + PyDev 3.7.0.

My goal is to execute a python script and being able to send commands to the console while stopped at a breakpoint, using its context and selecting several lines of code at once, with different indentations, like for loops, if statements, etc. This would be a similar debugging behavior as with MATLAB (selecting code and pressing F9), which I find really useful.

If I press ALT+CTRL+Enter without selecting any code the script is executed within the interactive console. The execution indeed stops at the first breakpoint. I can inspect the variables, but the console does not prompt me for any input. I can select and send commands with ALT+CTRL+Enter, but they are greyed out, and not interpreted at all. If I'm not stopped at a breakpoint, this method does not support blocks of code with different indentations, like for loops, when prompted for commands.

If I run a normal debug session, without pressing ALT+CTRL+Enter, I can stop at a breakpoint and have some interaction, like typing single commands (displayed in green, not in grey), but I cannot send several commands, and they need to have the right indentation. Launching an interactive console at this point will result in a new console with a new context.

Is there any way to select and send a block of code to the interactive console while being stopped at a breakpoint, using the context at that moment?. Is it possible to do this with any other IDE?

I've seen similar questions in SO like this question, or this answer, but this is still unclear to me.

Upvotes: 1

Views: 1193

Answers (1)

Fabio Zadrozny
Fabio Zadrozny

Reputation: 25332

As it is now, it works at that as an interactive console -- so, the indentation really needs to be right with Ctrl+Alt+Enter, but if you use F2 instead, it should work better (as F2 is meant to fix the indentation and should do what you want)...

Reference: http://pydev.org/manual_adv_interactive_console.html

Upvotes: 2

Related Questions