array problems.. OverflowError

ashtonn@gmail.com doodle4 at gmail.com
Wed Jun 8 13:40:43 EDT 2005


How do i fill 1 byte and 4 bytes in a single array? This array contains
packet information.

Python code...

from array import *

size = 526
pData = array("B", '\0'* 526)
# Destination MAC address
destAddress = FFFFFFFFFFFF
for i in range(0, len(destAddress), 2):
    pData[i/2] = int(destAddress[i:i+2], 16)

pattern = 0xAAAAAAAA
for i in range(  512):
    pData[i+6] = long(pattern, 16)
print pData

OverflowError: long int too large to covert to int

def test(pData.buffer_info()[0])
    ....
    ....
Any help appreciated.
-Ashton




More information about the Python-list mailing list