First time here? Check out the FAQ!
1

Logging- debug I/O to file

Is there a way to log the debug I/O output to file to overcome its limited buffer?

anonymous user
Anonymous
asked 2023-11-18 15:24:24 -0500
Wingware Support's avatar
4k
Wingware Support
updated 2023-11-21 10:11:45 -0500
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

2 Answers

0

You can use an external console by selecting the Configure External Console item in the Debug I/O tool's Options menu. That doesn't have an I/O limit like the integrated Debug I/O tool.

Wingware Support's avatar
4k
Wingware Support
answered 2023-11-19 15:02:59 -0500
edit flag offensive 0 remove flag delete link

Comments

1

No, it has a line limit, much more limited than the integrated Debug I/O tool. You can change the limit, but up to 999 lines maximum

Massimo's avatar Massimo (2023-11-20 02:28:25 -0500) edit

Oh, sorry, I misunderstood and thought you were referring to the rate limit on the integrated Debug I/O tool. What OS are you on? I'm surprised any modern console implementation would limit to 999 lines max!

Wingware Support's avatar Wingware Support (2023-11-20 09:51:16 -0500) edit

Incidentally, we'll try to see if we can increase or make the line limit in the Debug I/O tool configurable. It looks like it's currently 100K lines, which apparently we thought would be "enough for anyone" at some point in the past. Do you have a sense for how many lines would be enough for you, in case we just change the hardwired max? Actually even if we make it configurable, I'd like to make sure it still works reasonably when there are as many lines as you're expecting. Thanks!

Wingware Support's avatar Wingware Support (2023-11-20 09:55:12 -0500) edit
add a comment see more comments
0

Another approach to this is to change sys.stdout and/or sys.stderr in your code to route output to a file. Something like:

import sys 
f = open('output.txt', 'w')
old = sys.stdout 
sys.stdout = f 
...
sys.stdout = old 
f.close()

You can of course do this conditionally, possibly only when 'WINGDB_ACTIVE' in os.environ is true, which is only the case when Wing's debugger is active.

Wingware Support's avatar
4k
Wingware Support
answered 2023-11-21 10:15:53 -0500
edit flag offensive 0 remove flag delete link

Comments

1

Good, this is working

Massimo's avatar Massimo (2023-11-29 11:23:31 -0500) 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