Tango
Tango

Reputation: 678

Exit Python Module WIthout Exiting PyDev Console

I'm using Eclipse Neon.2 Release (4.6.2) on MacOS 10.12.3 and PyDev 5.5.0.201701191708. I have a few subroutines in the module I'm working on that will need to exit to the command line when I run this script in bash. I use sys.exit(0), but have also used exit(0). When I test this module in the PyDev console, these statements exit the console as well as the module.

How can I quit the module without quitting the console? While I can use a return statement in debugging, when I'm done and this is being run from the command line, I want program execution to stop at these points and exit back to the command line.

Upvotes: 0

Views: 296

Answers (1)

Fabio Zadrozny
Fabio Zadrozny

Reputation: 25372

I must say it's a bit hard to know what exactly you want from your description...

So, I'll give you some choices:

  1. You can use the interactive console to call each of your functions (http://www.pydev.org/manual_adv_interactive_console.html) -- note that you can even start it under the debugger to see locals, have breakpoints, etc (http://www.pydev.org/manual_adv_interactive_console.html#full-debug-support-in-interactive-console).

  2. Just run it under the debugger and put breakpoints where you want.(http://www.pydev.org/manual_adv_debugger.html)

  3. Actually structure your code the way you said (although I find it a bit strange... can you give more details on what exactly you'd want to achieve and why you want that workflow?)

Upvotes: 1

Related Questions