diff options
-rw-r--r-- | CHANGELOG.md | 3 | ||||
-rw-r--r-- | cmd2/clipboard.py | 3 | ||||
-rwxr-xr-x | cmd2/cmd2.py | 2 | ||||
-rwxr-xr-x | tests/test_cmd2.py | 2 |
4 files changed, 6 insertions, 4 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 8eebf8b2..24063db3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ## 0.9.17 (TBD, 2019) * Bug Fixes - * Fixed a bug when using WSL and all Windows paths have been removed from $PATH + * Fixed a bug when using WSL when all Windows paths have been removed from $PATH + * Fixed a bug when running a cmd2 application on Linux without Gtk libraries installed * Enhancements * No longer treating empty text scripts as an error condition diff --git a/cmd2/clipboard.py b/cmd2/clipboard.py index 18370f9a..deb2f5cc 100644 --- a/cmd2/clipboard.py +++ b/cmd2/clipboard.py @@ -10,8 +10,9 @@ from pyperclip import PyperclipException try: # Try getting the contents of the clipboard _ = pyperclip.paste() -except (PyperclipException, FileNotFoundError): +except (PyperclipException, FileNotFoundError, ValueError): # NOTE: FileNotFoundError is for Windows Subsystem for Linux (WSL) when Windows paths are removed from $PATH + # NOTE: ValueError is for headless Linux systems without Gtk installed can_clip = False else: can_clip = True diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py index 900a4c75..c7b759c1 100755 --- a/cmd2/cmd2.py +++ b/cmd2/cmd2.py @@ -2056,7 +2056,7 @@ class Cmd(cmd.Cmd): elif statement.output: import tempfile if (not statement.output_to) and (not self._can_clip): - self.perror("Cannot redirect to paste buffer; install 'pyperclip' and re-run to enable") + self.perror("Cannot redirect to paste buffer; missing 'pyperclip' and/or pyperclip dependencies") redir_error = True elif statement.output_to: diff --git a/tests/test_cmd2.py b/tests/test_cmd2.py index 313b4dee..fc8a1dae 100755 --- a/tests/test_cmd2.py +++ b/tests/test_cmd2.py @@ -1332,7 +1332,7 @@ def test_clipboard_failure(base_app, capsys): # Make sure we got the error output out, err = capsys.readouterr() assert out == '' - assert "Cannot redirect to paste buffer; install 'pyperclip' and re-run to enable" in err + assert 'Cannot redirect to paste buffer;' in err and 'pyperclip' in err class CommandResultApp(cmd2.Cmd): |