summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd Leonhardt <todd.leonhardt@gmail.com>2017-07-10 21:45:21 -0400
committerTodd Leonhardt <todd.leonhardt@gmail.com>2017-07-10 21:45:21 -0400
commit839646c947c2be134dfc054222ec4e1a490b6259 (patch)
tree4ea36cab021f0fb3308859b1cd3366f454acc760
parent08cee23ec10f22da1eb54944c8e01564c16a5c33 (diff)
downloadcmd2-git-839646c947c2be134dfc054222ec4e1a490b6259.tar.gz
Minor attempt at ruggedization of clipboard stuff in some weird cases on Python 2
-rwxr-xr-xcmd2.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/cmd2.py b/cmd2.py
index e638d401..e5ee62c0 100755
--- a/cmd2.py
+++ b/cmd2.py
@@ -319,7 +319,8 @@ def get_paste_buffer():
"""
pb_str = pyperclip.paste()
- if six.PY2:
+ # If value returned from the clipboard is unicode and this is Python 2, convert to a "normal" Python 2 string first
+ if six.PY2 and not isinstance(pb_str, str):
import unicodedata
pb_str = unicodedata.normalize('NFKD', pb_str).encode('ascii', 'ignore')