summaryrefslogtreecommitdiff
path: root/cmd2.py
diff options
context:
space:
mode:
Diffstat (limited to 'cmd2.py')
-rwxr-xr-xcmd2.py23
1 files changed, 12 insertions, 11 deletions
diff --git a/cmd2.py b/cmd2.py
index c7c54e26..54072d99 100755
--- a/cmd2.py
+++ b/cmd2.py
@@ -53,16 +53,6 @@ except ImportError:
# noinspection PyUnresolvedReferences
from pyperclip import PyperclipException
-# On some systems, pyperclip will import gtk for its clipboard functionality.
-# The following code is a workaround for gtk interfering with printing from a background
-# thread while the CLI thread is blocking in raw_input() in Python 2 on Linux.
-try:
- # noinspection PyUnresolvedReferences
- 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
@@ -105,7 +95,18 @@ if six.PY3:
else:
BROKEN_PIPE_ERROR = IOError
-__version__ = '0.7.9a'
+# On some systems, pyperclip will import gtk for its clipboard functionality.
+# The following code is a workaround for gtk interfering with printing from a background
+# thread while the CLI thread is blocking in raw_input() in Python 2 on Linux.
+if six.PY2 and sys.platform.startswith('lin'):
+ try:
+ # noinspection PyUnresolvedReferences
+ import gtk
+ gtk.set_interactive(0)
+ except ImportError:
+ pass
+
+__version__ = '0.7.9'
# Pyparsing enablePackrat() can greatly speed up parsing, but problems have been seen in Python 3 in the past
pyparsing.ParserElement.enablePackrat()