Issues with Station Registry

64 views
Skip to first unread message

Bostjan Potocnik

unread,
Jun 22, 2020, 2:42:53 AM6/22/20
to weewx-user
Hi,

with version 4.1.1 I have problems with Station Registry. I guess it has to do with station location name and locale used!
If i'm correct "\u0161" is leter "š" and the name of my station location is:

[Station]
   
    # Description of the station location
    location = Loka pri Mengšu


Jun 21 21:10:40 RPi-SDR weewx[1348] ERROR weewx.restx: StationRegistry: Unexpected exception of type <type 'exceptions.KeyError'>
Jun 21 21:10:40 RPi-SDR weewx[1348] ERROR weewx.restx: *** Traceback (most recent call last):
Jun 21 21:10:40 RPi-SDR weewx[1348] ERROR weewx.restx: ***   File "/usr/share/weewx/weewx/restx.py", line 378, in run_loop
Jun 21 21:10:40 RPi-SDR weewx[1348] ERROR weewx.restx: ***     self.process_record(_record, dbmanager)
Jun 21 21:10:40 RPi-SDR weewx[1348] ERROR weewx.restx: ***   File "/usr/share/weewx/weewx/restx.py", line 426, in process_record
Jun 21 21:10:40 RPi-SDR weewx[1348] ERROR weewx.restx: ***     _url = self.format_url(_full_record)
Jun 21 21:10:40 RPi-SDR weewx[1348] ERROR weewx.restx: ***   File "/usr/share/weewx/weewx/restx.py", line 1489, in format_url
Jun 21 21:10:40 RPi-SDR weewx[1348] ERROR weewx.restx: ***     _liststr.append(urllib.parse.quote_plus(StationRegistryThread._FORMATS[_key] % v, '='))
Jun 21 21:10:40 RPi-SDR weewx[1348] ERROR weewx.restx: ***   File "/usr/lib/python2.7/urllib.py", line 1306, in quote_plus
Jun 21 21:10:40 RPi-SDR weewx[1348] ERROR weewx.restx: ***     s = quote(s, safe + ' ')
Jun 21 21:10:40 RPi-SDR weewx[1348] ERROR weewx.restx: ***   File "/usr/lib/python2.7/urllib.py", line 1301, in quote
Jun 21 21:10:40 RPi-SDR weewx[1348] ERROR weewx.restx: ***     return ''.join(map(quoter, s))
Jun 21 21:10:40 RPi-SDR weewx[1348] ERROR weewx.restx: *** KeyError: u'\u0161'

Regards,

Boštjan

Greg from Oz

unread,
Jun 22, 2020, 7:59:24 AM6/22/20
to weewx-user
It will probably work if you put quotes around the name

location = "text example"

Tom Keffer

unread,
Jun 22, 2020, 8:28:08 AM6/22/20
to weewx-user
Unfortunately, putting quotes around the name will not help. 

Apparently, the Python 2 version of urllib.parse.quote_plus(), which escapes special characters, does not work with unicode. I will come up with a patch.

In the meantime, you can use Python 3.

-tk

On Mon, Jun 22, 2020 at 4:59 AM Greg from Oz <ubea...@gmail.com> wrote:
It will probably work if you put quotes around the name

location = "text example"

--
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 weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/584b3eb2-08b0-4c4c-ba41-d21632d95767o%40googlegroups.com.

Tom Keffer

unread,
Jun 22, 2020, 8:38:56 AM6/22/20
to weewx-user
Try this version of restx.py. It should replace the version in /usr/share/weewx/weewx/restx.py.

-tk
restx.py

Bostjan Potocnik

unread,
Jun 22, 2020, 11:34:05 AM6/22/20
to weewx...@googlegroups.com
Hi,

I copied it and tested. It seems OK!

...
Jun 22 17:20:58 RPi-SDR weewx[6982] INFO weewx.restx: StationRegistry: Published record 2020-06-22 17:20:00 CEST (1592839200)
...

Thanks a lot!


Regards,
  Boštjan
You received this message because you are subscribed to a topic in the Google Groups "weewx-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/weewx-user/j2uo6FmdOaU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/CAPq0zEA%3DGCqqOHP5Mr-KdynSL6po96%3D_oZSYyudwQb_-uKZnZw%40mail.gmail.com.


Reply all
Reply to author
Forward
0 new messages