DR
unread,Apr 30, 2026, 10:32:50 PM (22 hours ago) Apr 30Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to 'Jon Fear' via weewx-user
I am slowing working towards a live test of a sort of a driver to
deliver a packet to WeeWx.
Basically I have a Campbell Scientific datalogger gathering sensor
readings, and once every twenty seconds it writes a string to the serial
port.
My python 'driver' uses the serial readline to get the string, and it
does once things get going the first pass through.
I have the datalogger running all the time, and when I start my python
code the first pass is always reading a blank, so to speak, and all the
string conversions and such either return empty strings, or error out
with the attempt to float a value which isn't valid, yet.
I got around this for the time being by doing a len() on the readline
input string and only proceeding if the length is >1.
Then all seems to work since none of the splitting of the string into a
list and all has values rather than a blank to work with.
Somehow this seems inelegant and wonder if there is a better way to
approach this? Despite Googling and reading about serial input methods
and pyserial and Geeks and RealPython I do not seem to find an answer.
Should I just put up with it seeming an odd way to do this and writing
an if...: at the beginning and let it go since it is just the first pass
of the python code reading the serial input buffer and works OK from
then on out?
Dale