Merge pull request #13 from phillipkent/fix_bug_windows_readline
fix bug in using readline in WindowsI found a bug with use of 'readline' for Python 2.7 on Windows 7. Cloudmonkey fails to run with this error:
File c:\python27\lib\site-packages\cloudmonkey\cloudmonkey.py line 70 module>
If libedit in readline.__doc__
TypeError: argument of type NoneType is not iterable
It requires modification of cloudmonkey.py at line 70.
The error and fix are the same as reported here:
http://bugs.python.org/issue18852
https://hg.python.org/cpython/rev/3070fdd58645
Note: I haven't tested this for Cloudmonkey in other Windows versions, or other Python versions.
* pr/13:
fix bug in using readline in Windows
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
diff --git a/cloudmonkey/cloudmonkey.py b/cloudmonkey/cloudmonkey.py
index e32878e..b106362 100644
--- a/cloudmonkey/cloudmonkey.py
+++ b/cloudmonkey/cloudmonkey.py
@@ -67,7 +67,8 @@
print("Module readline not found, autocompletions will fail", e)
else:
import rlcompleter
- if 'libedit' in readline.__doc__:
+ readline_doc = getattr(readline, '__doc__', '')
+ if readline_doc is not None and 'libedit' in readline_doc:
readline.parse_and_bind("bind ^I rl_complete")
readline.parse_and_bind("bind ^R em-inc-search-prev")
normal_readline = False