[BangPypers] pack data

murugadoss murugadoss2884 at gmail.com
Fri May 28 09:19:31 CEST 2010


Hello all,

I am trying a sample program for send set of data [ kept in array]. I have
attached the code below,

import struct

sendvalues = [181, 98, 11, 01]
for i in range(4):
snddata = struct.pack('int',int(sendvalue[i]))
sendto(sndData,("localhost"))

i am getting error as,

Traceback (most recent call last):
  File "./clientudp.py", line 10, in <module>
    snddata = struct.pack('hhl',sendvalue[i])
  File "/usr/local/lib/python2.5/struct.py", line 63, in pack
    return o.pack(*args)
struct.error: pack requires exactly 3 arguments

can anyone please tell me, what is the issue and how to solve it.

Thank in advance
--
Thanks & Regards
V.Murugadoss


More information about the BangPypers mailing list