[python] Modul Struct
Jakub Vojacek
jakohv na seznam.cz
Pondělí Duben 9 19:12:47 CEST 2007
Ahoj
DÄlĂĄm si takovou vlastnĂ verzi icq. UĹž to umĂ posĂlat zprĂĄvy, ale poĹĂĄd mi nefunguje pĹĂjĂmĂĄnĂ a fakt nevĂm jak to zprovoznit.
KdyĹž mi nÄkdo poĹĄle zprĂĄvu, pĹijde mi to ve tvaru:
âźĂ§ âÂś âş 268803181 â âş âť P â âŚâş ⺠⣠âŚAÄÄ_ â âşâşĂŽĹdÄGVâŹU˧âáĂâ,C ⟠⌠>Ĺ
⼠âŚFâ4⏠❠ââŁâş âşâşâşâş funguj! â ⏠âŚFâsY âź âşâź
a kod by mÄl bĂ˝t:
def prijmi(self):
uin_len = struct.unpack('B', data[0x0a])[0]
msg_len = struct.unpack('!H', data[0x48:0x4a])[0] - 0x04
fmt = self.fmt % (uin_len, msg_len)
u = struct.unpack(fmt, data)
self.uin = u[2]
self.msg = u[4]
ale to mi vyhodĂ chybu:
Traceback (most recent call last):
File "C:\Documents and Settings\Blu\Plocha\py-icq-0.0.1\py-icq\src\main.py", l
ine 379, in ?
sys.exit(start(sys.argv))
File "C:\Documents and Settings\Blu\Plocha\py-icq-0.0.1\py-icq\src\main.py", l
ine 332, in start
conn.main_loop()
File "C:\Documents and Settings\Blu\Plocha\py-icq-0.0.1\py-icq\src\main.py", l
ine 82, in main_loop
self.handle_server_cmd(snac)
File "C:\Documents and Settings\Blu\Plocha\py-icq-0.0.1\py-icq\src\main.py", l
ine 131, in handle_server_cmd
m = proto.CMsgIn(snac.data)
File "C:\Documents and Settings\Blu\Plocha\py-icq-0.0.1\py-icq\src\proto.py",
line 289, in __init__
u = struct.unpack(fmt, data)
struct.error: unpack str size does not match format
Vubec nevĂm jak to zprovoznit a jsem vdÄÄnĂ˝ za kaĹždou radu.
Blujacker
------------- další část ---------------
HTML pĹĂloha byla odstranÄna...
URL: http://www.py.cz/pipermail/python/attachments/20070409/6a205235/attachment.htm
Další informace o konferenci Python