if someone could help me with this little problem that I am having. Let me tell you: I'm trying to make a python script that extracts some values from the iptraf-ng command. But when I try to run it I get an error that I don't know what it means:
File "Main.py", line 7 subprocess.run(cmd.split(),check=True)
IndentationError: unexpected indent" 
This is the script that I am trying to implement, if anyone sees something in the code that can be corrected, I would appreciate it. This is the code:
import subprocess
def get_iptraf_values(ens160):
   cmd = "iptraf-ng -i ens160 -L /home/Aliexer/iptraf.log"
    subprocess.run(cmd.split(),check=True)
    with open('home/Aliexer/iptraf.log') as f:
        lines = f.readlines()
    values = {}
    for line in lines:
        if 'PktsIn' in line:
            values['PktsIn'] = int(line.split()[1])
        elif 'IP In' in line:
            values['IP In'] = int(line.split()[1])
        elif 'BytesIn' in line:
            values['BytesIn'] = int(line.split()[1])
        elif 'InRate' in line:
            values['InRate'] = float(line.split()[1])
        elif 'PktsOut' in line:
            values['PktsOut'] = int(line.split()[1])
        elif 'IP Out' in line:
            values['IP Out'] = int(line.split()[1])
        elif 'BytesOut' in line:
            values['BytesOut'] = int(line.split()[1])
        elif 'OutRate' in line:
            values['OutRate'] = float(line.split()[1])
    return values
values = get_iptraf_values('ens160')
print(values)
I expected it to print the values I asked for from the ens160 interface, but instead I got an error. PS: I'm new to this python thing, and I'd appreciate a hand.
 
    