summaryrefslogtreecommitdiff
path: root/cmd2.py
diff options
context:
space:
mode:
Diffstat (limited to 'cmd2.py')
-rwxr-xr-xcmd2.py8
1 files changed, 3 insertions, 5 deletions
diff --git a/cmd2.py b/cmd2.py
index 97de8b0a..c17c8d07 100755
--- a/cmd2.py
+++ b/cmd2.py
@@ -196,10 +196,9 @@ def remaining_args(opts_plus_args, arg_list):
def _which(editor):
try:
+ editor_path = subprocess.check_output(['which', editor], stderr=subprocess.STDOUT).strip()
if six.PY3:
- editor_path = subprocess.check_output(['which', editor], stderr=subprocess.STDOUT, encoding='utf-8').strip()
- else:
- editor_path = subprocess.check_output(['which', editor], stderr=subprocess.STDOUT).strip()
+ editor_path = editor_path.decode()
except subprocess.CalledProcessError:
editor_path = None
return editor_path
@@ -974,7 +973,6 @@ class Cmd(cmd.Cmd):
# Getting help for a specific command
funcname = self._func_named(arg)
if funcname:
- fn = getattr(self, funcname)
# No special behavior needed, delegate to cmd base class do_help()
cmd.Cmd.do_help(self, funcname[3:])
else:
@@ -1602,7 +1600,7 @@ Edited files are run on close if the ``autorun_on_edit`` settable parameter is T
f.close()
self.pfeedback('Saved to {}'.format(fname))
except Exception as e:
- self.perror('Saving {!r} - {}'.format(fname, e.strerror), traceback_war=False)
+ self.perror('Saving {!r} - {}'.format(fname, e), traceback_war=False)
def do__relative_load(self, file_path):
"""Runs commands in script file that is encoded as either ASCII or UTF-8 text.