Allow commandline to load without readline for non-Unix systems
authorW. Trevor King <wking@drexel.edu>
Tue, 10 Aug 2010 10:44:50 +0000 (06:44 -0400)
committerW. Trevor King <wking@drexel.edu>
Tue, 10 Aug 2010 10:44:50 +0000 (06:44 -0400)
hooke/ui/commandline.py

index 02aa9acccc5b85dba2b4ecf432bb23e5db1e0364..4533217222eb467bab441d29e1f62f6ff210f121 100644 (file)
@@ -23,7 +23,11 @@ line.
 import codecs
 import cmd
 import optparse
-import readline # including readline makes cmd.Cmd.cmdloop() smarter
+try:
+    import readline # including readline makes cmd.Cmd.cmdloop() smarter
+except ImportError, e:
+    import logging
+    logging.warn('Could not import readline, bash-like line editing disabled.')
 import shlex
 
 from ..command import CommandExit, Exit, Command, Argument, StoreValue