472,119 Members | 1,555 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,119 software developers and data experts.

buffer_info error

Hello,

buffer_info is giving the following error:

AttributeError: 'str' object has not attribute 'buffer_info'

Here's the code snippet...

dest = 'FFFFFFFFFFFF'
src = '0123FFFFFFFF'

data = array('B', '\0' * 256)
data1 = ''.join([dest, src]
print data1
FFFFFFFFFFFF0123FFFFFFFF

print data.buffer_info()[0]... works

print data1.buffer_info()[0]....error

This output is a string and hence i believe i get the above error. Any
ideas?
Thanks,
-Ashton

Jul 19 '05 #1
2 1356
as*****@gmail.com wrote:
data = array('B', '\0' * 256)
data1 = ''.join([dest, src]

print data.buffer_info()[0]... works
print data1.buffer_info()[0]....error

This output is a string and hence i believe i get the above error. Any
ideas?


Yes, you are entirely correct. (Integers don't have "buffer_info"
attributes either, and for that matter strings don't have an attribute
called "fribble_frabble", in case you were thinking of trying that. ;-)

(That's a facetious reply, yes, because you gave no indication what you
were trying to accomplish. It's really hard to tell what you expected
versus what you got, and why you got that is completely obvious to all
of us, who can't read your mind.)

-Peter
Jul 19 '05 #2
i am filling in a packet with source and destination address and using
the buffer_info call to pass on the address to an underlying low level
call.

The src and dest are strings, but buffer_info expects an array. How do
i deal with this?

Jul 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Tony Wright | last post: by
1 post views Thread by Aravind | last post: by
1 post views Thread by yanwan | last post: by
5 posts views Thread by Enos Meroka | last post: by
7 posts views Thread by p | last post: by

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.