util: Improve Python3 compatibility
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
f5cdfad333
commit
8d8c239e47
|
@ -38,7 +38,7 @@ def create_pty(ptyname):
|
||||||
except os.error:
|
except os.error:
|
||||||
pass
|
pass
|
||||||
filename = os.ttyname(sfd)
|
filename = os.ttyname(sfd)
|
||||||
os.chmod(filename, 0660)
|
os.chmod(filename, 0o660)
|
||||||
os.symlink(filename, ptyname)
|
os.symlink(filename, ptyname)
|
||||||
set_nonblock(mfd)
|
set_nonblock(mfd)
|
||||||
old = termios.tcgetattr(mfd)
|
old = termios.tcgetattr(mfd)
|
||||||
|
@ -99,7 +99,7 @@ def get_cpu_info():
|
||||||
f = open('/proc/cpuinfo', 'rb')
|
f = open('/proc/cpuinfo', 'rb')
|
||||||
data = f.read()
|
data = f.read()
|
||||||
f.close()
|
f.close()
|
||||||
except IOError, OSError:
|
except (IOError, OSError) as e:
|
||||||
logging.debug("Exception on read /proc/cpuinfo: %s",
|
logging.debug("Exception on read /proc/cpuinfo: %s",
|
||||||
traceback.format_exc())
|
traceback.format_exc())
|
||||||
return "?"
|
return "?"
|
||||||
|
|
Loading…
Reference in New Issue