cwxn 0.4 error with weewx 4.2

48 views
Skip to first unread message

Ray Wells

unread,
Nov 27, 2020, 8:14:46 PM11/27/20
to weewx-user
My first post here and I'm confused already. Must be something to do with my age! If I'm doing something wrong just dig a hole and bury me.

This is advice on a fix rather than a call for help.

Ok, I'm setting up weewx v4.2 on a RPi4 as a new installation. I had been running v3.8 on the computer but it wasn't live, but worked fine. Weewx 4.2 appears to be working fine (with simulator) but my first extension, cwxn 0.4 bombed out with an error ... 

$ sudo tail /var/log/syslog
Nov 28 11:03:09 120wx weewx[2837] CRITICAL __main__:     ****      self.loadServices(config_dict)
Nov 28 11:03:09 120wx weewx[2837] CRITICAL __main__:     ****    File "/usr/share/weewx/weewx/engine.py", line 153, in loadServices
Nov 28 11:03:09 120wx weewx[2837] CRITICAL __main__:     ****      obj = weeutil.weeutil.get_object(svc)(self, config_dict)
Nov 28 11:03:09 120wx weewx[2837] CRITICAL __main__:     ****    File "/usr/share/weewx/weeutil/weeutil.py", line 1093, in get_object
Nov 28 11:03:09 120wx weewx[2837] CRITICAL __main__:     ****      mod = __import__(module)
Nov 28 11:03:09 120wx weewx[2837] CRITICAL __main__:     ****    File "/usr/share/weewx/user/cwxn.py", line 94
Nov 28 11:03:09 120wx weewx[2837] CRITICAL __main__:     ****      except Exception, e:
Nov 28 11:03:09 120wx weewx[2837] CRITICAL __main__:     ****                      ^
Nov 28 11:03:09 120wx weewx[2837] CRITICAL __main__:     ****  SyntaxError: invalid syntax
Nov 28 11:03:09 120wx weewx[2837] CRITICAL __main__:     ****  Exiting.

My online search for "except Exception, e:" revealed a change in syntax for Python v3.x and, after changing line 94 in cwxn.py to read "except Exception as e:" the extension now works as intended. 

Thought mwall might like to know.

BTW, cwxn formats humidity to 3 digits whereas the aprs spec calls for just 2. If cwxn is used for aprs the last digit is truncated making 20% (020) humidity appear as 2% (02). For my use I modified cwxn.py - problem solved.

Ray

Bill Arthur

unread,
Nov 28, 2020, 8:10:07 PM11/28/20
to weewx-user
Ray,
I'm successfully using cwxn, but I had problems earlier this year. (but not the problem you're having) 
Here is a thread discussing cwxn.py. Gary, gjr80 modified the file, you can find it in the fourth post in the following thread:
https://groups.google.com/g/weewx-user/c/TUn5ibGr9uo
Perhaps his modified fill will help you.
Reply all
Reply to author
Forward
0 new messages