make ip string

Signed-off-by: Ebbe Baß <ebbe.bass>
main
Ebbe Baß 2024-02-13 18:44:20 +01:00
parent a751b48974
commit dccb64666a
1 changed files with 1 additions and 1 deletions

View File

@ -6,7 +6,7 @@ import os
def get_eth0_ip(): def get_eth0_ip():
try: try:
# Get the IP address of the eth0 interface # Get the IP address of the eth0 interface
eth0_ip = os.system("ip -4 -o addr show eth0 | awk '{print $4}' | cut -d '/' -f 1 ") eth0_ip = str(os.system("ip -4 -o addr show eth0 | awk '{print $4}' | cut -d '/' -f 1 "))
return eth0_ip return eth0_ip
except (KeyError, IndexError, OSError) as e: except (KeyError, IndexError, OSError) as e:
print(f"Error getting eth0 IP: {e}") print(f"Error getting eth0 IP: {e}")