diff options
author | Andy Grover <andy@groveronline.com> | 2013-10-11 14:29:12 -0700 |
---|---|---|
committer | Andy Grover <andy@groveronline.com> | 2013-10-11 14:29:12 -0700 |
commit | 451a5260f37b07dbdb91ce3ce96c2912c23ea065 (patch) | |
tree | 035dbd6773a62624c0e8971504378a5b7f28c50f | |
parent | 66fce401f30f7f190d57b731ce7413d275f33c25 (diff) | |
parent | 5124f3ffe2e58245416595d4dc3763adc22fee35 (diff) | |
download | configshell-fb-451a5260f37b07dbdb91ce3ce96c2912c23ea065.tar.gz |
Merge pull request #5 from cvubrugier/2to3
2to3: preparatory work for python 3
-rw-r--r-- | configshell/node.py | 12 | ||||
-rw-r--r-- | configshell/shell.py | 8 |
2 files changed, 10 insertions, 10 deletions
diff --git a/configshell/node.py b/configshell/node.py index 51ab2e9..121e5dd 100644 --- a/configshell/node.py +++ b/configshell/node.py @@ -450,7 +450,7 @@ class ConfigNode(object): else: try: value = type_method(ui_value) - except ValueError, msg: + except ValueError as msg: raise ExecutionError(msg) else: return value @@ -509,7 +509,7 @@ class ConfigNode(object): if p_def['writable']: try: value = type_method(value) - except ValueError, msg: + except ValueError as msg: self.shell.log.error("Not setting %s! %s" % (param, msg)) else: @@ -698,7 +698,7 @@ class ConfigNode(object): ''' try: target = self.get_node(path) - except ValueError, msg: + except ValueError as msg: self.shell.log.error(msg) return @@ -1035,7 +1035,7 @@ class ConfigNode(object): # Normal path try: target_node = self.get_node(path) - except ValueError, msg: + except ValueError as msg: self.shell.log.error(msg) return None else: @@ -1097,7 +1097,7 @@ class ConfigNode(object): loop = urwid.MainLoop(frame, palette, input_filter=handle_input) try: loop.run() - except Selected, pos: + except Selected as pos: return int(str(pos)) def ui_complete_cd(self, parameters, text, current_param): @@ -1415,7 +1415,7 @@ class ConfigNode(object): try: self.assert_params(method, pparams, kparams) result = method(*pparams, **kparams) - except ExecutionError, msg: + except ExecutionError as msg: self.shell.log.error(msg) else: return result diff --git a/configshell/shell.py b/configshell/shell.py index fb82f8d..050f17f 100644 --- a/configshell/shell.py +++ b/configshell/shell.py @@ -821,7 +821,7 @@ class ConfigShell(object): if self._save_history: try: readline.write_history_file(self._cmd_history) - except IOError, msg: + except IOError as msg: self.log.warning( "Cannot write to command history file %s." \ % self._cmd_history) @@ -895,7 +895,7 @@ class ConfigShell(object): try: target = self._current_node.get_node(path) - except ValueError, msg: + except ValueError as msg: self.log.error(msg) else: result = None @@ -945,7 +945,7 @@ class ConfigShell(object): try: script_fd = open(script_path, 'r') self.run_stdin(script_fd, exit_on_error) - except IOError, msg: + except IOError as msg: raise IOError(msg) finally: script_fd.close() @@ -963,7 +963,7 @@ class ConfigShell(object): for cmdline in file_descriptor: try: self.run_cmdline(cmdline) - except Exception, msg: + except Exception as msg: self.log.error(msg) if exit_on_error is True: self.log.exception("Aborting run on error.") |