aboutsummaryrefslogtreecommitdiffstats
path: root/libbe/util/subproc.py
diff options
context:
space:
mode:
Diffstat (limited to 'libbe/util/subproc.py')
-rw-r--r--libbe/util/subproc.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/libbe/util/subproc.py b/libbe/util/subproc.py
index 0ad010c..5412b08 100644
--- a/libbe/util/subproc.py
+++ b/libbe/util/subproc.py
@@ -25,7 +25,7 @@ import sys
import types
import libbe
-from encoding import get_encoding
+from .encoding import get_encoding
if libbe.TESTING == True:
import doctest
@@ -56,7 +56,7 @@ def invoke(args, stdin=None, stdout=PIPE, stderr=PIPE, expect=(0,),
"""
if cwd == None:
cwd = '.'
- if isinstance(shell, types.StringTypes):
+ if isinstance(shell, (str,)):
list_args = ' '.split(args) # sloppy, but just for logging
str_args = args
else:
@@ -76,7 +76,7 @@ def invoke(args, stdin=None, stdout=PIPE, stderr=PIPE, expect=(0,),
# win32 don't have os.execvp() so have to run command in a shell
q = Popen(args, stdin=PIPE, stdout=stdout, stderr=stderr,
shell=shell, cwd=cwd, **kwargs)
- except OSError, e:
+ except OSError as e:
raise CommandError(list_args, status=e.args[0], stderr=e)
stdout,stderr = q.communicate(input=stdin)
status = q.wait()
@@ -84,10 +84,10 @@ def invoke(args, stdin=None, stdout=PIPE, stderr=PIPE, expect=(0,),
if encoding == None:
encoding = get_encoding()
if stdout != None:
- stdout = unicode(stdout, encoding)
+ stdout = str(stdout, encoding)
if stderr != None:
- stderr = unicode(stderr, encoding)
- libbe.LOG.debug(u'{0}\n{1}{2}'.format(status, stdout, stderr))
+ stderr = str(stderr, encoding)
+ libbe.LOG.debug('{0}\n{1}{2}'.format(status, stdout, stderr))
else:
libbe.LOG.debug('{0}\n{1}{2}'.format(status, stdout, stderr))
if status not in expect: