What's the difference between hitting 'Run' vs. typing 'runfile()'?

35 views
Skip to first unread message

Lucian Smith

unread,
Sep 30, 2020, 5:20:09 PM9/30/20
to spyd...@googlegroups.com
I have an odd problem with the way my python library interacts with Spyder, and I'm hoping someone here can shed some insight into what's happening.

The upshot is:  I get different behavior based on whether I hit the 'Run' button in Spyder vs. typing the 'runfile(...)' command that 'Run' produces into the console.  It has something to do with piping warnings/messages to the console window.  I'm hoping to figure out how to debug my library based on what, specifically, the difference is between those two activities.

If I hit 'Run', the following happens:
* The text 'runfile(...)' appears in the Console.
* The file executes and produces output
* The next prompt appears ('In [2]: ')
* A split second later, a warning from my library appears above the prompt.

If I then hit 'Run' again, the following happens:
* The text 'runfile(...)' appears in the Console.
* The file executes and produces output
* The next prompt appears ('In [3]: ')
* A split second later, a warning from my library *plus the previous warning* appears above the prompt.

This is cumulative: every time I hit 'run', one more warning is added to the list.  This is the behavior I would like to fix!

If I then hit the 'up' arrow in the console to re-execute the file, I get no warnings at all.  

If I run python from a command line instead of inside Spyder, I get a warning the first time, and not the second.  (The same thing happens if I type 'runfile' in the console by hand inside Spyder to start with.)  I'm actually trying to diagnose why that is, too, but the more-warnings-every-time thing is more obviously a problem.

The background is that the library is a C++ library with python bindings created with Swig.  It has a logging system that uses the 'SplitterChannel' class from the 'poco' library to pass warnings and other messages to the user.  This part of the library is somewhat of a mystery to me, but I can at least trace through the code.

Any insights appreciated!

-Lucian

salman tariq

unread,
Oct 7, 2020, 9:06:58 PM10/7/20
to spyd...@googlegroups.com
--
You received this message because you are subscribed to the Google Groups "spyder" group.
To unsubscribe from this group and stop receiving emails from it, send an email to spyderlib+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/spyderlib/CAHLmBr3sFuFS5mCbO7KXnmMLeQ%3DEoUY-pHL9EiD4JDJN_VzeQw%40mail.gmail.com.
IMG_20201004_155600_3.jpg
Reply all
Reply to author
Forward
0 new messages