mirror of
https://github.com/JoelBender/bacpypes
synced 2025-09-28 22:15:23 +08:00
closes #66
This commit is contained in:
parent
ef81ce6887
commit
48342e0bec
|
@ -8,7 +8,6 @@ import sys
|
||||||
import types
|
import types
|
||||||
import os
|
import os
|
||||||
import gc
|
import gc
|
||||||
import readline
|
|
||||||
import signal
|
import signal
|
||||||
import cmd
|
import cmd
|
||||||
import logging
|
import logging
|
||||||
|
@ -20,6 +19,12 @@ from .consolelogging import ConsoleLogHandler
|
||||||
|
|
||||||
from . import core
|
from . import core
|
||||||
|
|
||||||
|
# readline is used for history files
|
||||||
|
try:
|
||||||
|
import readline
|
||||||
|
except ImportError:
|
||||||
|
readline = None
|
||||||
|
|
||||||
# some debugging
|
# some debugging
|
||||||
_debug = 0
|
_debug = 0
|
||||||
_log = ModuleLogger(globals())
|
_log = ModuleLogger(globals())
|
||||||
|
@ -263,6 +268,7 @@ class ConsoleCmd(cmd.Cmd, Thread, Logging):
|
||||||
cmd.Cmd.preloop(self) ## sets up command completion
|
cmd.Cmd.preloop(self) ## sets up command completion
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
if readline:
|
||||||
readline.read_history_file(sys.argv[0] + ".history")
|
readline.read_history_file(sys.argv[0] + ".history")
|
||||||
except Exception, err:
|
except Exception, err:
|
||||||
if not isinstance(err, IOError):
|
if not isinstance(err, IOError):
|
||||||
|
@ -273,7 +279,8 @@ class ConsoleCmd(cmd.Cmd, Thread, Logging):
|
||||||
Despite the claims in the Cmd documentaion, Cmd.postloop() is not a stub.
|
Despite the claims in the Cmd documentaion, Cmd.postloop() is not a stub.
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
readline.write_history_file(sys.argv[0]+".history")
|
if readline:
|
||||||
|
readline.write_history_file(sys.argv[0] + ".history")
|
||||||
except Exception, err:
|
except Exception, err:
|
||||||
if not isinstance(err, IOError):
|
if not isinstance(err, IOError):
|
||||||
self.stdout.write("history error: %s\n" % err)
|
self.stdout.write("history error: %s\n" % err)
|
||||||
|
|
|
@ -8,7 +8,6 @@ import sys
|
||||||
import types
|
import types
|
||||||
import os
|
import os
|
||||||
import gc
|
import gc
|
||||||
import readline
|
|
||||||
import signal
|
import signal
|
||||||
import cmd
|
import cmd
|
||||||
import logging
|
import logging
|
||||||
|
@ -20,6 +19,12 @@ from .consolelogging import ConsoleLogHandler
|
||||||
|
|
||||||
from . import core
|
from . import core
|
||||||
|
|
||||||
|
# readline is used for history files
|
||||||
|
try:
|
||||||
|
import readline
|
||||||
|
except ImportError:
|
||||||
|
readline = None
|
||||||
|
|
||||||
# some debugging
|
# some debugging
|
||||||
_debug = 0
|
_debug = 0
|
||||||
_log = ModuleLogger(globals())
|
_log = ModuleLogger(globals())
|
||||||
|
@ -265,6 +270,7 @@ class ConsoleCmd(cmd.Cmd, Thread, Logging):
|
||||||
cmd.Cmd.preloop(self) ## sets up command completion
|
cmd.Cmd.preloop(self) ## sets up command completion
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
if readline:
|
||||||
readline.read_history_file(sys.argv[0] + ".history")
|
readline.read_history_file(sys.argv[0] + ".history")
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
if not isinstance(err, IOError):
|
if not isinstance(err, IOError):
|
||||||
|
@ -275,7 +281,8 @@ class ConsoleCmd(cmd.Cmd, Thread, Logging):
|
||||||
Despite the claims in the Cmd documentaion, Cmd.postloop() is not a stub.
|
Despite the claims in the Cmd documentaion, Cmd.postloop() is not a stub.
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
readline.write_history_file(sys.argv[0]+".history")
|
if readline:
|
||||||
|
readline.write_history_file(sys.argv[0] + ".history")
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
if not isinstance(err, IOError):
|
if not isinstance(err, IOError):
|
||||||
self.stdout.write("history error: %s\n" % err)
|
self.stdout.write("history error: %s\n" % err)
|
||||||
|
|
|
@ -8,7 +8,6 @@ import sys
|
||||||
import types
|
import types
|
||||||
import os
|
import os
|
||||||
import gc
|
import gc
|
||||||
import readline
|
|
||||||
import signal
|
import signal
|
||||||
import cmd
|
import cmd
|
||||||
import logging
|
import logging
|
||||||
|
@ -20,6 +19,12 @@ from .consolelogging import ConsoleLogHandler
|
||||||
|
|
||||||
from . import core
|
from . import core
|
||||||
|
|
||||||
|
# readline is used for history files
|
||||||
|
try:
|
||||||
|
import readline
|
||||||
|
except ImportError:
|
||||||
|
readline = None
|
||||||
|
|
||||||
# some debugging
|
# some debugging
|
||||||
_debug = 0
|
_debug = 0
|
||||||
_log = ModuleLogger(globals())
|
_log = ModuleLogger(globals())
|
||||||
|
@ -266,6 +271,7 @@ class ConsoleCmd(cmd.Cmd, Thread, Logging):
|
||||||
cmd.Cmd.preloop(self) ## sets up command completion
|
cmd.Cmd.preloop(self) ## sets up command completion
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
if readline:
|
||||||
readline.read_history_file(sys.argv[0] + ".history")
|
readline.read_history_file(sys.argv[0] + ".history")
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
if not isinstance(err, IOError):
|
if not isinstance(err, IOError):
|
||||||
|
@ -276,7 +282,8 @@ class ConsoleCmd(cmd.Cmd, Thread, Logging):
|
||||||
Despite the claims in the Cmd documentaion, Cmd.postloop() is not a stub.
|
Despite the claims in the Cmd documentaion, Cmd.postloop() is not a stub.
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
readline.write_history_file(sys.argv[0]+".history")
|
if readline:
|
||||||
|
readline.write_history_file(sys.argv[0] + ".history")
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
if not isinstance(err, IOError):
|
if not isinstance(err, IOError):
|
||||||
self.stdout.write("history error: %s\n" % err)
|
self.stdout.write("history error: %s\n" % err)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user