Hi Gary,
You are correct as far as the data file being the issue. I confirmed this
by creating a data file and then making sure that every record was
complete. Ran weewx using this data file and it proceeded with no issues.
I am using an arduino uno to collect the sensor data and then sending it
out to a raspberry pi via serial port and saving it to a file.I have
noticed that when the arduino starts sending data, it may send two or three
lines of 'garbage" to start off. Is there a way to ensure that those lines
are discarded? I am a newbie to python.
Also, I put that line into the fileparse.py file, but I did not notice any
more info being given regarding the error in the syslog.
Ron
On Thursday, June 20, 2019 at 11:55:59 AM UTC-4, gjr80 wrote:
>
> Ron,
>
> Since your data file field names are in fact WeeWX field names there is no
> need for a field map, I only asked because if you had one and it had some
> issues then it could be messing things up.
>
> On looking again at the fileparse code I realise I mis-read it, though I
> am still sure that the issue is an occasional malformed data file. The
> fileparse driver is pretty basic, it splits each line at the '=', the
> string on the left of the '=' is the field name and the string on the right
> is the data. The data is converted to a float. If the data cannot be
> converted to a float WeeWX logs the offending field name and the error
> message. So in the case of this line:
>
> Jun 19 16:55:30 WeatherPi weewx[32206]: fileparse: cannot read value for
> '': could not convert string to float: l
>
> it tells us that fileparse tried to process the field '' (ie an empty
> string) but it could not convert the field data to a float with the error
> message being 'could not convert string to float: l'. That particular
> error message displays the offending data after the : and for some reason
> it has been truncated. Since it is a l (lower case L) I suspect that
> somehow the data file has been malformed and 'lightLevel' has somehow
> ended up on the right hand side of an '=' and since the corresponding field
> name is an empty string. Either that or the data file is badly mangled. I
> would say that at some stage your data file has a line:
>
> =lightLevel
>
> Have you been monitoring the data file when the error occurs? You could
> try adding some debug code to fileparse.py, edit fileparse.py and add the
> highlighted line shown below:
>
> def _get_as_float(d, s):
> v = None
> if s in d:
> try:
> v = float(d[s])
>
> except ValueError as e:
> loginf("d=%s" %(d, ))
> logerr("cannot read value for '%s': %s" % (s, e))
> return v
>
> save the file then restart WeeWX. Next time WeeWX encounters that
> particular error it will dump the entire dictionary of data that it read
> from the file. Ideally we would like to see the data file but to do so
> would take a bit more code, this is a simple one liner that will give us he
> next best thing and may give us a clue as to what is going on with the data
> file.
>
> Gary
>
--
You received this message because you are subscribed to the Google Groups
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/weewx-user/546ace24-51d1-4479-a937-6680c2dc4d9d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.