diff --git a/addons/hw_escpos/controllers/main.py b/addons/hw_escpos/controllers/main.py index 6c929ca2f26..35efc5216ea 100644 --- a/addons/hw_escpos/controllers/main.py +++ b/addons/hw_escpos/controllers/main.py @@ -2,7 +2,6 @@ # Part of Odoo. See LICENSE file for full copyright and licensing details. from __future__ import print_function -import commands import logging import math import os @@ -196,7 +195,7 @@ class EscposDriver(Thread): hosting_ap = os.system('pgrep hostapd') == 0 ssid = subprocess.check_output('iwconfig 2>&1 | grep \'ESSID:"\' | sed \'s/.*"\\(.*\\)"/\\1/\'', shell=True).rstrip() mac = subprocess.check_output('ifconfig | grep -B 1 \'inet addr\' | grep -o \'HWaddr .*\' | sed \'s/HWaddr //\'', shell=True).rstrip() - ips = [ c.split(':')[1].split(' ')[0] for c in commands.getoutput("/sbin/ifconfig").split('\n') if 'inet addr' in c ] + ips = [ c.split(':')[1].split(' ')[0] for c in subprocess.check_output("/sbin/ifconfig").split('\n') if 'inet addr' in c ] ips = [ ip for ip in ips if ip not in localips ] eprint.text('\n\n') eprint.set(align='center',type='b',height=2,width=2) diff --git a/addons/hw_proxy/controllers/main.py b/addons/hw_proxy/controllers/main.py index f341ab7b9e0..0521b72c89b 100644 --- a/addons/hw_proxy/controllers/main.py +++ b/addons/hw_proxy/controllers/main.py @@ -2,8 +2,8 @@ # Part of Odoo. See LICENSE file for full copyright and licensing details. from __future__ import print_function -import commands import logging +import subprocess import time from threading import Lock @@ -16,11 +16,11 @@ _logger = logging.getLogger(__name__) # Those are the builtin raspberry pi USB modules, they should # not appear in the list of connected devices. -BANNED_DEVICES = set([ +BANNED_DEVICES = { "0424:9514", # Standard Microsystem Corp. Builtin Ethernet module "1d6b:0002", # Linux Foundation 2.0 root hub "0424:ec00", # Standard Microsystem Corp. Other Builtin Ethernet module -]) +} # drivers modules must add to drivers an object with a get_status() method @@ -99,14 +99,14 @@ class Proxy(http.Controller): """ if debug is None: resp += """(debug version)""" - devices = commands.getoutput("lsusb").split('\n') + devices = subprocess.check_output("lsusb").split('\n') count = 0 resp += "