Ask Your Question
1

How load PYTHONSTARTUP for Debug Probe?

asked 2018-12-08 20:41:00 -0600

Mitchell L Model gravatar image

updated 2019-03-13 10:29:53 -0600

I know that I can specify a PYTHONSTARTUP file in the Environment section of the Environment tab of the Project Properties dialog, and I can see in the Python Shell tool that my file has in fact been loaded. However, when I am debugging my program the Debug Probe environment does not contain the definitions from my startup file. How do I  get the file to load into the debug environment?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
1

answered 2018-12-10 08:44:00 -0600

The Debug Probe is designed to work in the currently selected stack frame, so if you're trying to get the environment from the outermost stack frame you would just select that from the stack popup.  You can also run selected code in the current stack frame using Evaluate Selection in Debug Probe in the Source menu, although this alters the state of at least the current frame in the debug process so may not make sense to do.

edit flag offensive delete link more

Comments

Unless I explicitly import my PYTHONSTARTUP file into at least one module, top-level code it contains never gets executed when debugging, even though it does get executed when starting a Python Shell. Definitions it contains are not in the outermost stack frame unless I explicitly import it into the main module.I guess this is the converse of the old it-hurts-when-I-do-this-so-don't-do-that joke: it doesn't happen when I don't import the file, so import it!

Mitchell L Model gravatar imageMitchell L Model ( 2018-12-11 00:30:00 -0600 )edit

PYTHONSTARTUP is something Python provides specifically for the interactive mode and the file is not read when you use Python to run a file, which is what starting debug from Wing is emulating.  You could use the Python Shell in Wing and turn on debugging from it in its Options menu, and then you can debug code started from there.  This can be combined with using the Debug Probe, which will be active when debug is later paused at a breakpoint, exception, etc.  Or, you can enable the recursive prompt in the Python Shell, also from its Options menu, so you get a >>> prompt again when you're debugging something and it pauses.  From that point you can invoke and debug other things to any depth.  Continuing debug goes back to the most recent recursive stopping point, which at the top level means just returning to the prompt.  This can ...(more)

Wingware Support gravatar imageWingware Support ( 2018-12-11 09:17:00 -0600 )edit

Thanks — that's all great information."Debugging" is inherently interactive, so it never occurred to me that the Wing debugger wasn't running in what Python would consider an interactive mode.

Mitchell L Model gravatar imageMitchell L Model ( 2018-12-11 14:17:00 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2018-12-08 20:41:00 -0600

Seen: 95 times

Last updated: Dec 10 '18