Hi, im getting a problem when executing a scrip in python
im trying to Ping a list of IP and capture the output in other text file, but im getting this error
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa1 in position 311: invalid start byte
this is my script
import subprocess
with open('IP-list.txt', 'rb') as f, open('ip_out.txt', 'wb') as f_out:
for adress in f:
adress = adress.strip()
response = subprocess.run(['ping', adress], capture_output=True)
print(response.stdout.decode())
f_out.write(response.stdout)