473,657 Members | 2,358 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

array problems.. OverflowError

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.buff er_info()[0])
....
....
Any help appreciated.
-Ashton

Jul 19 '05 #1
1 1757
You probably want to look at using struct.pack. That will allow you
to back heterogenious groups of data into a string that can be saved
to disk or sent over the network. It also does a really good job of
taking care of byte order for you(if you tell it to).

-Chris

On 8 Jun 2005 10:40:43 -0700, as*****@gmail.c om <do*****@gmail. com> wrote:
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.buff er_info()[0])
....
....
Any help appreciated.
-Ashton

--
http://mail.python.org/mailman/listinfo/python-list

--
Christopher Lambacher
la******@comput er.org
Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2769
by: Paolo Alexis Falcone | last post by:
Whenever I try to access a table with many rows using PgSQL's fetchall(), this happens: >>> from pyPgSQL import PgSQL >>> db = PgSQL.connect("192.168.0.8:5432:whitegold","dondon","dondon") >>> PgSQL.NoPostgresCursor = 1 >>> cur = db.cursor() >>> cur.execute("SELECT * FROM customer") >>> data = cur.fetchall() Traceback (most recent call last):
2
1768
by: Luke | last post by:
Hi, I'm getting an OverflowError which doesn't make sense to me. Is this a python bug? Traceback (most recent call last): File "/home/demoau/lib/py/omniORB/__init__.py", line 717, in static_is_a for b in cls.__bases__: OverflowError: long int too large to convert to int
3
3137
by: ashtonn | last post by:
Hello, I am trying to fill in a dword value into an array and i get an overflowerror Here's what iam trying to do. from array import * data = array('B', '\0' * 256) val = 0xFFFFFFFF
4
9992
by: Sheldon | last post by:
Hi, I have a written a script that will check to see if the divisor is zero before executing but python will not allow this: if statistic_array > 0.0: statistic_array = int(multiply(divide(statistic_array,statistic_array \ ),10000.0))/100.0
2
9540
by: Jorgen Bodde | last post by:
Hi List I am working on an app to store guitar songs I am practicing, and for the fun of it I want to store the date of songs when they were originally made. So far so good.. However, my taste of music is "Rag Time Blues" and that os OLD, very OLD music. So it happened I entered a song from the date " 28 dec 1928".
1
4321
by: khgoh | last post by:
Hi, Need help for the error "OverflowError: long int too large to convert to int" while reading a zip file content. Python version: Python 2.4.1 (#1, Sep 13 2005, 00:39:20) on linux2 Code >>> import os, datetime, sys, optparse, string, operator, gzip >>> health_day_summary_file = gzip.GzipFile( "health_CORR_summary.csv.gz", "rb")
0
986
by: Manuel Vazquez Acosta | last post by:
Hi all, I'm debugging a Plone site in an AMD64 laptop. When I first tried to run Zope, I got this exception: OverflowError: signed integer is greater than maximum In the archives I encounter no solutions. This is what I could find, so I share with you all:
0
211
by: Terry Reedy | last post by:
Manuel Vazquez Acosta wrote: In general, versions numbers for both Python and the app are helpful. Archives: Python? Zope? Plone? I hope you have/will report this to the appropriate place.
5
4387
by: Tzury Bar Yochay | last post by:
What is the reason math.pow yields OverflowError while python itself can calculate these large numbers. e.g: 1e+308 Traceback (most recent call last): File "<stdin>", line 1, in <module> OverflowError: math range error 10000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000
0
8411
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
8513
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8613
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6176
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4173
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4329
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2740
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1969
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1732
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.