Scott David Daniels wrote: > > Match the new warning protocol exactly: > def showwarning(message, category, filename, lineno, > file=None, line=None): > ... > If the line is not None, use it (which will happen if you pass it > along to showwarning). > If the line is None and file is not None, use file to get to your > line, rather than opening the filename which may not work. > Sorry, this had no sooner left my terminal than I realized that the file argument is the output target, and nothing to do with fetching source. I'd not put the data into the log if file is provided, because it may be code trying to extract output formatting. I'd do something like this: if file is not None: old_showwarning(message, category, filename, lineno, file, line) return at the top of the code. --Scott David Daniels Scott.Daniels at Acm.Org
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4