upload to wetter.com fails - python3

50 views
Skip to first unread message

Roland Lang

unread,
Jun 14, 2020, 6:11:15 AM6/14/20
to weewx-user
Hi,
yesterday I updated my weewx installation from python2 to python3. The Upload to wetter.com fails now with following error (but weewx keeps on working):

Jun 14 10:25:29 wetter python3[5775]: weewx[5775] ERROR weewx.restx: Wetter: Unexpected exception of type <class 'TypeError'>
Jun 14 10:25:29 wetter python3[5775]: weewx[5775] ERROR weewx.restx: *** Traceback (most recent call last):
Jun 14 10:25:29 wetter python3[5775]: weewx[5775] ERROR weewx.restx: ***   File "/usr/share/weewx/weewx/restx.py", line 378, in run_loop
Jun 14 10:25:29 wetter python3[5775]: weewx[5775] ERROR weewx.restx: ***     self.process_record(_record, dbmanager)
Jun 14 10:25:29 wetter python3[5775]: weewx[5775] ERROR weewx.restx: ***   File "/usr/share/weewx/weewx/restx.py", line 442, in process_record
Jun 14 10:25:29 wetter python3[5775]: weewx[5775] ERROR weewx.restx: ***     self.post_with_retries(_request, data)
Jun 14 10:25:29 wetter python3[5775]: weewx[5775] ERROR weewx.restx: ***   File "/usr/share/weewx/weewx/restx.py", line 484, in post_with_retries
Jun 14 10:25:29 wetter python3[5775]: weewx[5775] ERROR weewx.restx: ***     self.check_response(_response)
Jun 14 10:25:29 wetter python3[5775]: weewx[5775] ERROR weewx.restx: ***   File "/usr/share/weewx/user/wetter.py", line 143, in check_response
Jun 14 10:25:29 wetter python3[5775]: weewx[5775] ERROR weewx.restx: ***     if txt.find('"errorcode":"100"') != -1 or \
Jun 14 10:25:29 wetter python3[5775]: weewx[5775] ERROR weewx.restx: *** TypeError: argument should be integer or bytes-like object, not 'str'
Jun 14 10:25:29 wetter python3[5775]: weewx[5775] CRITICAL weewx.restx: Wetter: Thread terminating. Reason: argument should be integer or bytes-like object, not 'str'

I got it working again by commenting out the whole if..else statement in wetter.py, as it is only a check for errors. But that's of course not the final solution :-)
    140     def check_response(self, response):
   
141         """Override, and check for wetter errors."""
   
142         txt = response.read().lower()
   
143   #     if txt.find('"errorcode":"100"') != -1 or \
   
144   #        txt.find('"errorcode":"101"') != -1 or \
   
145   #        txt.find('"errorcode":"102"') != -1:
   
146   #         raise weewx.restx.BadLogin(txt)
   
147   #     elif txt.find('"status":"error"') != -1:
   
148   #         raise weewx.restx.FailedPost("Server returned '%s'" % txt)

Can you please help me? I don't have a clue about python (yet).

Regards,
Roland

Tom Keffer

unread,
Jun 20, 2020, 8:27:03 AM6/20/20
to weewx-user
Roland,

Could you please replace the file user/wetter.py with this one, then try again?

-tk

--
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/137870dd-4d32-4288-9e27-2fcc0a6b26ado%40googlegroups.com.
wetter.py

Roland Lang

unread,
Jun 20, 2020, 2:23:14 PM6/20/20
to weewx-user
Hi Tom,
thank you, this is working now!

Roland
Reply all
Reply to author
Forward
0 new messages