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