Python Struct错误表示无法将参数强制转换为int

时间:2019-03-10 16:04:11

标签: python struct server pack

我正在尝试在python中使用struct模块来打包位。目前,我不断收到错误消息,指出无法将该参数转换为int类型。我传递的参数是一个整数文字(特别是0)。

这是我收到的回溯。

Traceback (most recent call last):
File "client.py", line 130, in <module>
main()
File "client.py", line 66, in main
s.connect((destination,port))
File "file.py", line 116, in connect
0,0,0,0)
struct.error: cannot convert argument to integer

以下是相关代码:

  first_fin = self.header_struct.pack(self.version, FIN, self.opt_ptr,
                                  self.protocol, self.header_len,self.checksum,
                                  self.source_port,self.dest_port,
                                  0,0,0,0)

0 个答案:

没有答案