Skip to content

Add option to not print output#416

Open
Darkdadaah wants to merge 1 commit intotatuylonen:mainfrom
Darkdadaah:quiet_output
Open

Add option to not print output#416
Darkdadaah wants to merge 1 commit intotatuylonen:mainfrom
Darkdadaah:quiet_output

Conversation

@Darkdadaah
Copy link
Copy Markdown

Add 'quiet_output' to Wtp to not print errors to stdout via _fmt_errmsg()

When parsing a dump the output from errors (Wtp.error() and the likes) can be quite overwhelming, and not needed when all the errors are accessible via Wtp.to_return() in a parsable data structure. This new option to Wtp helps keep the output quiet when it is not needed.
I considered using the quiet parameter, but its current use is to quiet the logging. Better not mix things up I suppose.

Usage:

wtp = Wtp(quiet_output=True)

(Defaults to False, current behavior)

NB: the error messages sent to stdout cause a problem with unittest for wiktextractor where the parser is run in threads, in which case the stdout of the threads can't be captured by unittest. This PR is an attempt to mitigate that problem without drastic changes to the current behavior of the code.

Add 'quiet_output' to Wtp to not print errors to stdout via _fmt_errmsg()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant