diff options
| author | Todd Leonhardt <todd.leonhardt@gmail.com> | 2018-03-21 14:41:30 -0400 |
|---|---|---|
| committer | Todd Leonhardt <todd.leonhardt@gmail.com> | 2018-03-21 14:41:30 -0400 |
| commit | 9902cb2c6447e58ef12438ac711addc192b8f1f5 (patch) | |
| tree | 80b1974893f88143dfc4ad9ae5bcfdc2bf6593ab /cmd2.py | |
| parent | 450466e560b312034d4a4cf0a256e6051954d1f4 (diff) | |
| download | cmd2-git-9902cb2c6447e58ef12438ac711addc192b8f1f5.tar.gz | |
Added back in preference for gnureadline if it is present
Now that the crash bug in the gnureadline Python module which statically links against a compatible version of GNU Readline has been fixed for macOS, we added back in the top-level import boilerplate to prefer it if it is available.
Also updated some documentation in relation to getting readline installed for macOS.
Diffstat (limited to 'cmd2.py')
| -rwxr-xr-x | cmd2.py | 14 |
1 files changed, 9 insertions, 5 deletions
@@ -88,13 +88,17 @@ try: except ImportError: ipython_available = False -# Try to import readline, but allow failure for convenience in Windows unit testing -# Note: If this actually fails, you should install readline on Linux or Mac or pyreadline on Windows +# Prefer statically linked gnureadline if available (for macOS compatibility due to issues with libedit) try: - # noinspection PyUnresolvedReferences - import readline + import gnureadline as readline except ImportError: - pass + # Try to import readline, but allow failure for convenience in Windows unit testing + # Note: If this actually fails, you should install readline on Linux or Mac or pyreadline on Windows + try: + # noinspection PyUnresolvedReferences + import readline + except ImportError: + pass # BrokenPipeError and FileNotFoundError exist only in Python 3. Use IOError for Python 2. if six.PY3: |
