lheijst / weewx-rtldavis

weewx driver that captures data from software-defined radio using the rtldavis software.
GNU General Public License v3.0
14 stars 5 forks source link

IndexError: list index out of range #1

Closed uvedhe closed 3 years ago

uvedhe commented 5 years ago

I'm trying to read in wind data from my weather station into a Python script, to then be able to do some calculations with the data. I discovered WeeWX and thought this was the way to go. Now I've been trying to get the RTL Davis driver to work. I'm using an RTL-SDR v3 dongle on OS X 10.13. I can successfully run $GOPATH/bin/rtldavis which returns various entries, like these:

19:10:43.856163 Init channels: wait max 17 seconds for a message of each transmitter
19:11:01.793521 Init channels: wait max 17 seconds for a message of each transmitter
19:11:01.794049 Hop: {ChannelIdx:0 ChannelFreq:868077250 FreqError:0}
19:11:19.732536 Init channels: wait max 17 seconds for a message of each transmitter
19:11:19.732580 Hop: {ChannelIdx:0 ChannelFreq:868077250 FreqError:0}

Now I was hoping to actually get some data out, so I thought I needed to install the rtldavis driver. Install all went successfully, but when I run PYTHONPATH=bin python bin/user/rtldavis.py --cmd="/Users/user/go/bin/rtldavis" I get the error IndexError: list index out of range.

Not sure where it's going wrong?

Here's the full output:

19:03:46.160784 rtldavis.go VERSION=0.12
19:03:46.161047 tr=1 fc=0 ppm=0 gain=0 ex=0 maxmissed=51 actChan=[0] maxChan=1
19:03:46.161326 BitRate: 19200
19:03:46.161340 SymbolLength: 14
19:03:46.161347 SampleRate: 268800
19:03:46.161359 Preamble: 1100101110001001
19:03:46.161368 PreambleSymbols: 16
19:03:46.161375 PreambleLength: 224
19:03:46.161387 PacketSymbols: 80
19:03:46.161394 PacketLength: 1120
19:03:46.161405 BlockSize: 512
19:03:46.161411 BufferLength: 2048
Found Rafael Micro R820T tuner
19:03:46.610555 Hop: {ChannelIdx:0 ChannelFreq:868077250 FreqError:0}
Exact sample rate is: 268800.001367 Hz
19:03:46.814340 GetTunerGain: 0 Db
19:03:46.814362 SetFreqCorrection 0 ppm Successful
19:03:46.818456 Init channels: wait max 17 seconds for a message of each transmitter
Traceback (most recent call last):
  File "bin/user/rtldavis.py", line 1337, in <module>
    payload = lines[0].strip()
IndexError: list index out of range
lheijst commented 5 years ago

Hi,

I have copied your question to the weewx-rtldavis topic in the weewx-development forum. See: https://groups.google.com/forum/#!topic/weewx-development/jhGleLxu-p0%5B201-225%5D

Your will find my answer there.

Luc

nyavlis commented 5 years ago

uvedhe,

I've experienced this bug this morning and I've checked the code of rtldavis.py. You simply have missed your customizations in your command line when testing the driver.

rtldavis.py : There's a 10s timeout in get Queue() (for stderr). 485 line = self.stderr_queue.get(True, 10).decode('utf-8')

If the rtldavis binary GO program does not recognises any ISS, it will wait for 17 seconds and at line 1337, get_stderr times out after 10s, and lines is "null" -> list index out of range

It works when rtldavis is running well, with your custom parameters, for ex for me :

root@nulinux:/usr/share/weewx# sudo PYTHONPATH=. python user/rtldavis.py --cmd="/root/go/bin/rtldavis -tr=1 -tf="EU" -fc=4750"