[wingide-users] behavior of __file__ in shell vs debug process

Wing IDE Support support at wingware.com
Fri Jun 6 11:00:05 EDT 2014


On 6/5/14, 11:49 PM, Matthew Bibee via wingide-users wrote:
> If I run this in the shell (clicking options “Evaluate myFile.py”) then it says the name of the file is “_sandbox.py” and top of the frame is <winddb_compile>.  It causes my actual script to bomb in a very unpleasant way as it can not actually find the file that was running.  I was not expecting this when running at the shell.  I was thinking my script would just run the way it normally runs at the command line and I could then try out some things on the shell prompt after it is finished.  However it seems like the only way I can make this particular script work is to run in the debugger and make sure I have a dummy line of code at the end of the file with a break point set.

I think what you want to do is run in the debugger, set a breakpoint on 
the last line, and use the Debug Probe.  Evaluating in the Python Shell 
is (roughly) the equivalent of copying the text from the file and then 
pasting it into the Python Shell so there's no __file__ set.

We plan to add an option to the debugger to stop just before the program 
exits.

Cheers,

John



More information about the wingide-users mailing list