Commits

Olivier Grisel  committed 7594f3f

Be robust when clipboard is not working properly

  • Participants
  • Parent commits 90481d8

Comments (0)

Files changed (1)

File virtualkeyring.py

 
 try:
     import xerox as clipboard
+
+    # Check that the clipboard is active
+    from xerox.base import ToolNotFound
+    try:
+        clipboard.paste()
+    except ToolNotFound:
+        clipboard = None
 except ImportError:
     clipboard = None
 
-
 ONE_BYTE = 2 ** 8
 DEFAULT_LENGTH = 8  # default password length
 DEFAULT_ALPHABET = string.lowercase + string.uppercase + string.digits