def attributes(self):
    try:
        out = subprocess.check_output(self.attrcmd)
    except (OSError, subprocess.CalledProcessError) as err:
        print('Error running command: {0}'.format(err), file=sys.stderr)
        return
    for line in out.split('\n'):
        res = re.match('\\s*(?P<id>\\d+)\\s+(?P<name>[\\w-]+)\\s+(?P<flags>[POSRCK-]{6})\\s+(?P<value>\\d+)\\s+(?P<worst>\\d+)\\s+(?P<thres>\\d+)\\s+(?P<fail>[\\w-]+)\\s+(?P<raw_value>\\d+)', line)
        if (not res):
            continue
        (yield res.groupdict())
def attributes(self):
    try:
        out = subprocess.check_output(self.attrcmd)
    except (OSError, subprocess.CalledProcessError) as err:
        print('Error running command: {0}'.format(err), file=sys.stderr)
        return
    for line in out.split('\n'):
        res = re.match('\\s*(?P<id>\\d+)\\s+(?P<name>[\\w-]+)\\s+(?P<flags>[POSRCK-]{6})\\s+(?P<value>\\d+)\\s+(?P<worst>\\d+)\\s+(?P<thres>\\d+)\\s+(?P<fail>[\\w-]+)\\s+(?P<raw_value>\\d+)', line)
        if (not res):
            continue
        (yield res.groupdict())