Skip to content

Commit 7ef6a8d

Browse files
committed
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.
1 parent 3a58cab commit 7ef6a8d

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

cmd2.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,14 @@
4646
import pyparsing
4747
import pyperclip
4848

49+
# Workaround for gtk interfering when printing from background thread while main
50+
# thread is blocking in raw_input() in Python 2 on Linux when gtk is installed
51+
try:
52+
import gtk
53+
gtk.set_interactive(0)
54+
except ImportError:
55+
pass
56+
4957
# next(it) gets next item of iterator it. This is a replacement for calling it.next() in Python 2 and next(it) in Py3
5058
from six import next
5159

0 commit comments

Comments
 (0)