summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd Leonhardt <todd.leonhardt@gmail.com>2019-09-02 11:37:09 -0400
committerTodd Leonhardt <todd.leonhardt@gmail.com>2019-09-02 11:37:09 -0400
commit4e76883966b4f5d33d982041affd2beec67c68b5 (patch)
treef7ed52b167020dddefb42142abd364feb9ca5e1e
parentd6549c847a40e995dc6d6bcbf8ace1c121c4b0ee (diff)
downloadcmd2-git-4e76883966b4f5d33d982041affd2beec67c68b5.tar.gz
Fix what is fundamentally a Pyperclip bug on headless Linux systems without Gtk libraries
-rw-r--r--CHANGELOG.md1
-rw-r--r--cmd2/clipboard.py3
2 files changed, 3 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index cb7ff7ba..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 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