On Linux (Ubuntu) Wayland display system, when the pyperclip.paste() function is called and when the clipboard is empty, a message is printed on the screen: Nothing is copied
This comes from either of the two code statements:
- https://github.com/bugaevc/wl-clipboard/blob/aaa927ee7f7d91bcc25a3b68f60d01005d3b0f7f/src/wl-paste.c#L267
bail("Nothing is copied");
- https://github.com/bugaevc/wl-clipboard/blob/aaa927ee7f7d91bcc25a3b68f60d01005d3b0f7f/src/wl-paste.c#L227
bail("Nothing is copied");
The bail() macro function is defined in https://github.com/bugaevc/wl-clipboard/blob/aaa927ee7f7d91bcc25a3b68f60d01005d3b0f7f/src/util/misc.h#L25 as:
#define bail(message) do { fprintf(stderr, message "\n"); exit(1); } while (0)
I tried the following, but to no avail:
import os
import contextlib
with contexlib.redirect_stdout(open(os.devnull, "w")) and contexlib.redirect_stderr(open(os.devnull, "w")):
...
I believe this is because the printing is done from an external program.
This can however be suppressed by redirecting stderr to an anonymous pipe, just as it was done for stdout.
On Linux (Ubuntu) Wayland display system, when the pyperclip.paste() function is called and when the clipboard is empty, a message is printed on the screen:
Nothing is copiedThis comes from either of the two code statements:
The
bail()macro function is defined in https://github.com/bugaevc/wl-clipboard/blob/aaa927ee7f7d91bcc25a3b68f60d01005d3b0f7f/src/util/misc.h#L25 as:I tried the following, but to no avail:
I believe this is because the printing is done from an external program.
This can however be suppressed by redirecting
stderrto an anonymous pipe, just as it was done forstdout.