From 919a3af93a3ff755cbac48bef97d3fef2e512ce0 Mon Sep 17 00:00:00 2001 From: Tom Keffer Date: Mon, 11 May 2015 14:07:23 -0700 Subject: [PATCH] A bad CWOP server address no longer crashes the CWOP thread. --- TODO.txt | 7 +++++++ bin/weewx/restx.py | 9 +++++++-- docs/changes.txt | 2 ++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/TODO.txt b/TODO.txt index 33e19376..2d3fa90f 100644 --- a/TODO.txt +++ b/TODO.txt @@ -1,6 +1,13 @@ TODO: items for the next release; complete list is at github ------------------------------------------------------------------------------- +Some inconsistencies on the "name" of a driver. In the User's Guide, it +tells you to set station_type to what is really the stanza name --- +something like FineOffsetUSB. However, the utility wee_config requires +you to specify the actual driver location, weewx.drivers.fousb. + +Similar problem with extension names. + test deb upgrades test wee_extension on deb system diff --git a/bin/weewx/restx.py b/bin/weewx/restx.py index fa9e94fe..45dede58 100644 --- a/bin/weewx/restx.py +++ b/bin/weewx/restx.py @@ -1050,8 +1050,13 @@ class CWOPThread(RESTThread): # a connection that works: for _serv_addr_str in self.server_list: - _server, _port_str = _serv_addr_str.split(":") - _port = int(_port_str) + try: + _server, _port_str = _serv_addr_str.split(":") + _port = int(_port_str) + except ValueError: + syslog.syslog(syslog.LOG_ALERT, + "restx: Bad CWOP server address: '%s'; ignoring..." % _serv_addr_str) + continue # Try each combination up to max_tries times: for _count in range(self.max_tries): diff --git a/docs/changes.txt b/docs/changes.txt index 24507983..768368e6 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -50,6 +50,8 @@ decimal point. Increased precision of barometer posts to WOW from 1 to 3 decimal points. +A bad CWOP server address no longer crashes the CWOP thread. + The "alarm" example now includes a try block to catch a NameError exception should the alarm expression include a variable not in the archive record.