20200914 -
Traceback (most recent call last):
File "convert.py", line 49, in <module>
main()
File "convert.py", line 12, in main
pcapin = dpkt.pcap.Reader(fin)
File "/usr/local/lib/python3.6/site-packages/dpkt/pcap.py", line 280, in __init__
buf = self.__f.read(FileHdr.__hdr_len__)
File "/usr/lib64/python3.6/codecs.py", line 321, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd4 in position 0: invalid continuation byte
上述代码仅仅是python3使用dpkt读取数据包而已,没有任何其他操作,但是直接报错了,在python2中没有这个错误。谷歌了一下,找到的github上的issue[1],应该在打开文件的时候使用'rb'
方式打开。