Skip to content
This repository has been archived by the owner on Sep 16, 2024. It is now read-only.

AttributeError: 'socket' object has no attribute 'readinto' #610

Open
rroeber opened this issue Dec 23, 2022 · 0 comments
Open

AttributeError: 'socket' object has no attribute 'readinto' #610

rroeber opened this issue Dec 23, 2022 · 0 comments

Comments

@rroeber
Copy link

rroeber commented Dec 23, 2022

Board: fipy

Firmware info:

(sysname='FiPy', nodename='FiPy', release='1.20.2.r6', version='v1.11-c5a0a97 on 2021-10-28', machine='FiPy with ESP32', lorawan='1.0.2', sigfox='1.0.1', pybytes='1.7.1')

I implemented a function to read data from a socket connection into a buffer. The relevant code is:

s = socket.socket(socket.AF_LORA, socket.SOCK_RAW) 

buf = bytearray(NUM_PACKETS)
mv = memoryview(buf)

idx = 0
while idx < num_packets:
    bytes_read = s.readinto(mv[idx:])
    idx += bytes_read
    print('.', end='')

The s.send() and s.receive() functions elsewhere in my program work correctly. When the program executes the s.readinto() function it gives the error:
AttributeError: 'socket' object has no attribute 'readinto'

What do I need to do to correct the error?
Thanks.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant