Comment 13 for bug 1945661

Revision history for this message
David A. Desrosiers (setuid) wrote :

I believe I've nailed this one down, after a day of heads-down testing.

The issue boils down to this bit of code, in /usr/lib/python3/dist-packages/cmd2.py:

    # The extraneous output bug in pyperclip on Linux using xclip was fixed in more recent versions of pyperclip
    if sys.platform.startswith('linux') and pyperclip_ver < 1.6:
        # Avoid extraneous output to stderr from xclip when clipboard is empty at cost of overwriting clipboard contents
        pyperclip.copy('')
    else:
        # Try getting the contents of the clipboard
        _ = pyperclip.paste()

Specifically that last line: `_ = pyperclip.paste()`, which assumes a clipboard exists and has been initialized. In most cases, it has not/will not be.

The attached diff to cmd2.py will allow these commands to succeed. I initially added some debug to allow me to see if the clipboard was accessible or not, and that's how I found this.

Let me know if this is sufficient to SRU into the python3-cmd2 package to address this.