buffer_info error

A

ashtonn

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 data1print 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
 
P

Peter Hansen

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
 
A

ashtonn

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,239
Messages
2,571,200
Members
47,840
Latest member
Tiffany471

Latest Threads

Top