python rookie, while watching the python subprocess
tutorial of Liao Xuefeng, I encountered the following error report when executing nslookup
command
operating system: win10 python version: 3.7
import subprocess
print("$ nslookup")
p = subprocess.Popen(["nslookup"], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
output, err = p.communicate(b"set q=mx\npython.org\nexit\n")
print(output.decode("utf-8"))
print("Exit code:", p.returncode)
error message:
$ nslookup
Traceback (most recent call last):
File "E:/py/learning-python/Process_Thread/multi_process/sub_process.py", line 14, in <module>
print(output.decode("utf-8"))
UnicodeDecodeError: "utf-8" codec can"t decode byte 0xc8 in position 2: invalid continuation byte
Process finished with exit code 1
what is the cause of this error? How to solve it? thank you.