First time here? Check out the FAQ!
1

How load PYTHONSTARTUP for Debug Probe?

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?

Mitchell L Model's avatar
13
Mitchell L Model
asked 2018-12-08 20:41:00 -0600
Wingware Support's avatar
4.2k
Wingware Support
updated 2019-03-13 10:29:53 -0600
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

1 Answer

1

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.

Wingware Support's avatar
4.2k
Wingware Support
answered 2018-12-10 08:44:00 -0600
edit flag offensive 0 remove flag delete link

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's avatar Mitchell 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's avatar Wingware 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's avatar Mitchell L Model (2018-12-11 14:17:00 -0600) edit
add a comment see more comments

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss.

Add Answer