Click here to Skip to main content
15,664,182 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi, I am facing the issue when i want to pack the ethernet packet fields by using verilog_struct.pack() method.

Error I am pasting below:
Traceback (most recent call last):
File "", line 42, in
verilog_data = verilog_struct.pack(*ip_fields)
struct.error: pack expected 1 items for packing (got 2)

My code is:
from struct import *
fields = 
verilog_struct = struct.Struct(">6s6s")
for pkt in ins:
ip_fields = (pkt.src,pkt.dst)
verilog_data = verilog_struct.pack(*ip_fields)

Please let me know, where is the issue in my code?

What I have tried:

verilog_struct.pack() issue::Not able to pack the ethernet packet fileds
Updated 17-Feb-23 3:18am
Richard MacCutchan 16-Feb-23 11:27am    
The message is clear; check the documentation to see what parameter the pack function expects.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900