I am using curses alongside the logging module and I’m having a problem with logging when curses is started.
Logging is working and prints some text to console (depending on the level) until curses.initscr() is called.
Any idea on how to fix it?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Once curses is initialized, you should perform all output through it – otherwise it’ll look goofy (as you’re seeing).
You can’t just use print/sys.(stdout|stderr).write, as it’ll interfere with ncurses output.
Best solution would be, make an ncurses pad to use for logging, redirect all log messages to it. You can customize your logging handler to do this (take a look at logging.handlers for some inspiration).