xmikos / soapy_power

Obtain power spectrum from SoapySDR devices (RTL-SDR, Airspy, SDRplay, HackRF, bladeRF, USRP, LimeSDR, etc.)
MIT License
164 stars 35 forks source link

soapypower/writer.py line 78 read self.header_struct struct.error: unpack requires a buffer of x bytes... #23

Open rbenali opened 4 years ago

rbenali commented 4 years ago

Hi, got this error when reading from an open-ended file: sopypower/writer.py line 78 in read self.header_struct struct.error: unpack requires a buffer of 59 bytes [https://github.com/xmikos/soapy_power/blob/master/soapypower/writer.py#L78] Since io.read(size) rely on the underlying OS that may signal interrupt the syscall before returning exactly that size rather than less, then keep iterating syscall reading up to filling up at least header_struct size buffer before unpacking fixed the above error... "...read syscall(,,count) it is not an error if this number is smaller than the number of bytes requested; this may happen for example because fewer bytes are actually available right now..."