summaryrefslogtreecommitdiff
path: root/cmd2.py
diff options
context:
space:
mode:
authorTodd Leonhardt <todd.leonhardt@gmail.com>2017-08-15 19:28:12 -0400
committerTodd Leonhardt <todd.leonhardt@gmail.com>2017-08-15 19:28:12 -0400
commit7ef6a8d1cd9802eacb4cb99d1db0c75d06ad75be (patch)
tree7dffcfdc79ed290329e657415ffc538a6e779c17 /cmd2.py
parent3a58cab25b3ae57899cf317e7260aecdcfc11e62 (diff)
downloadcmd2-git-7ef6a8d1cd9802eacb4cb99d1db0c75d06ad75be.tar.gz
Added workaround for bug in Python 2 on Linux when pygtk is installed
This bug is exposed by cmd2's dependency on pyperclip and pyperclip's optional dependency on pygtk.
Diffstat (limited to 'cmd2.py')
-rwxr-xr-xcmd2.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/cmd2.py b/cmd2.py
index c688be9d..baacabdd 100755
--- a/cmd2.py
+++ b/cmd2.py
@@ -46,6 +46,14 @@ from optparse import make_option
import pyparsing
import pyperclip
+# Workaround for gtk interfering when printing from background thread while main
+# thread is blocking in raw_input() in Python 2 on Linux when gtk is installed
+try:
+ import gtk
+ gtk.set_interactive(0)
+except ImportError:
+ pass
+
# next(it) gets next item of iterator it. This is a replacement for calling it.next() in Python 2 and next(it) in Py3
from six import next