weewx upgrade from python2 to python3

738 views
Skip to first unread message

Season Ticket

unread,
Aug 31, 2020, 4:55:26 PM8/31/20
to weewx-user
i'm running weewx on raspbian v9,  with python 2.7 weewx 4.1.1,  and I'm trying to upgrade to python3.  I already have python version 3.5.3 installed.

what do I need to do to run weewx under python3?


PRETTY_NAME="Raspbian GNU/Linux 9 (stretch)"
NAME="Raspbian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
ID=raspbian
ID_LIKE=debian

pi@raspberrypi:~ $ python --version
Python 2.7.13

pi@raspberrypi:~ $ python3 --version
Python 3.5.3


wee_config --version
4.1.1


Tom Keffer

unread,
Aug 31, 2020, 5:08:58 PM8/31/20
to weewx-user
Take a look at the prerequisite requirements for the setup.py instructions. Specifically:

sudo apt update

# Required
sudo apt install python3-configobj
sudo apt install python3-pil
sudo apt install python3-serial
sudo apt install python3-usb

# The following tests for distutils and installs if not present:
python3 -c "import distutils" 2>/dev/null || sudo apt install python3-distutils

# Install pip3 and cheetah3:
sudo apt install python3-pip
sudo pip3 install cheetah3

# Optional: for extended almanac information
sudo apt install python3-ephem

# Required if you are using MySQL (MariaDB):
sudo apt install mysql-client
sudo apt install python3-mysqldb

--
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/a8ad9b18-aaf9-4267-ae4a-0ab78337df6an%40googlegroups.com.

Season Ticket

unread,
Aug 31, 2020, 5:55:40 PM8/31/20
to weewx-user
if I choose these instructions  what do I change home to,  weewx.conf is in /etc/weewx?
To specify an install location different from the default /home/weewx, modify the parameter home in the setup.cfg file. Mac users will want to change it to /Users/Shared/weewx.  

Tom Keffer

unread,
Aug 31, 2020, 6:06:15 PM8/31/20
to weewx-user
I'm assuming you want to keep everything the same, except you want to run under Python 3. So, all you have to do is make sure python3 gets invoked, instead of python2. How to do that depends on your install method.

A, If you did a package install using apt-get, you will need to go into /etc/default/weewx and change option WEEWX_PYTHON to

WEEWX_PYTHON=/usr/bin/python3

B. If you did a setup.py install, you will have to change the very first line of /home/weewx/bin/weewxd to read

#!/usr/bin/python3

Same with other utilities. 

-tk

Season Ticket

unread,
Aug 31, 2020, 6:26:40 PM8/31/20
to weewx-user

I changed /etc/default/weewx to use /usr/bin/python3
then 

sudo dpkg -i python-weewx_4.1.1-1_all.deb

but now weewx won't start and no logs in /var/log/syslog

Tom Keffer

unread,
Aug 31, 2020, 6:49:51 PM8/31/20
to weewx-user
Any particular reason why you tried to reinstall weewx? And, the version you reinstalled is for python2.

NB: there is only one code base for weewx. There is no separate Python 2 and Python 3 versions. The only difference between the two packages is in which prerequisites get installed. But, the actually weewx code base is identical.

That is why you only needed to install the new prerequisites.

Surely there is something in the logs. What happens if you try to run weewxd directly from the command line?


Season Ticket

unread,
Sep 1, 2020, 4:39:47 AM9/1/20
to weewx-user
thanks for your persistence with this.
I reinstalled because I expected that the code would need to be recompiled with python3.  
I can revert back to python2  by,  a) changing the /etc/defaults/weewx to reference python2 and then reinstall again using "sudo dpkg -i python-weewx_4.1.1-1_all.deb"
I tried again this time with only changing the /etc/defaults/weewx file and running weewxd.  

This time I got some errors due to the following:
     user.alarm_multi.MyAlarm,
     user.opsgenie.OpsGenieAlerts, user.opsgenie.OpsGenieHeartbeat
which I have removed and now weewxd works fine

However when I start the daemon "sudo /etc/init.d/weewx start" I still get nothing,   no process is started and no logs.  Any ideas?

Tom Keffer

unread,
Sep 1, 2020, 7:40:31 AM9/1/20
to weewx-user
You're making things harder than it needs to be! No need to recompile anything. That is done automatically by the interpreter.

1. What is in /etc/default/weewx? 

2. In /etc/default/weewx, the variable WEEWX_BIN points to the copy of weewxd to be used. Make sure it exists. If it does not, this will cause /etc/init.d/weewx to exit without warning.

-tk

Season Ticket

unread,
Sep 1, 2020, 8:08:53 AM9/1/20
to weewx-user
ok thanks I didn't know that the recompile would be done automatically.

here is the content of /etc/default/weewx
pi@raspberrypi:~ $ more /etc/default/weewx
WEEWX_PYTHON=/usr/bin/python3
WEEWX_BINDIR=/usr/share/weewx
WEEWX_BIN=/usr/bin/weewxd
WEEWX_CFG=/etc/weewx/weewx.conf

and

pi@raspberrypi:~ $ ls -altr /usr/bin/weewxd
-rwxr-xr-x 1 root root 279 Jun  1 23:16 /usr/bin/weewxd
pi@raspberrypi:~ $ ls -altr /usr/bin/python3
lrwxrwxrwx 1 root root 9 Jan 20  2017 /usr/bin/python3 -> python3.5
pi@raspberrypi:~ $ ls -altr /usr/bin/python2
lrwxrwxrwx 1 root root 9 Jan 24  2017 /usr/bin/python2 -> python2.7
pi@raspberrypi:~ $ ls -altr /usr/share/weewx
total 284
-rwxr-xr-x   1 root root 23741 Jun  1 23:16 wunderfixer
-rwxr-xr-x   1 root root  9840 Jun  1 23:16 weewxd
-rwxr-xr-x   1 root root  3806 Jun  1 23:16 wee_reports
-rwxr-xr-x   1 root root 38823 Jun  1 23:16 wee_import
-rwxr-xr-x   1 root root  3157 Jun  1 23:16 wee_extension
-rwxr-xr-x   1 root root  2195 Jun  1 23:16 wee_device
-rwxr-xr-x   1 root root 16776 Jun  1 23:16 wee_debug
-rwxr-xr-x   1 root root 43183 Jun  1 23:16 wee_database
-rwxr-xr-x   1 root root  5637 Jun  1 23:16 wee_config
-rw-r--r--   1 root root 32452 Jun  1 23:16 six.py
-rw-r--r--   1 root root  2888 Jun  1 23:16 daemon.py
drwxr-xr-x 237 root root 12288 Aug 29 22:38 ..
drwxr-xr-x   2 root root  4096 Sep  1 09:10 weeimport
-rw-r--r--   1 root root 31099 Sep  1 09:10 six.pyc
-rw-r--r--   1 root root  2712 Sep  1 09:10 daemon.pyc
drwxr-xr-x   2 root root  4096 Sep  1 09:11 weeplot
drwxr-xr-x  11 root root  4096 Sep  1 09:14 .
drwxr-xr-x   3 root root  4096 Sep  1 09:14 weecfg
drwxr-xr-x   2 root root  4096 Sep  1 09:14 __pycache__
drwxr-xr-x   3 root root  4096 Sep  1 09:14 weeutil
drwxr-xr-x   3 root root  4096 Sep  1 09:14 weedb
drwxr-xr-x   4 root root  4096 Sep  1 09:14 weewx
drwxr-xr-x   4 root root  4096 Sep  1 09:14 user
drwxr-xr-x   3 root root  4096 Sep  1 09:14 schemas
pi@raspberrypi:~ $ ls -altr /etc/weewx/weewx.conf
-rw-r--r-- 1 root root 31815 Sep  1 09:22 /etc/weewx/weewx.conf



Tom Keffer

unread,
Sep 1, 2020, 8:32:15 AM9/1/20
to weewx-user
What are the results of the command

sudo systemctl status weewx

Then try it again after trying to start weewxd:

sudo /etc/init.d/weewx start
sudo systemctl status weewx




Season Ticket

unread,
Sep 1, 2020, 9:13:38 AM9/1/20
to weewx-user
here are the logs

pi@raspberrypi:~ $ sudo systemctl status weewx
● weewx.service - LSB: weewx weather system
   Loaded: loaded (/etc/init.d/weewx; generated; vendor preset: enabled)
   Active: active (exited) since Tue 2020-09-01 09:14:20 BST; 4h 57min ago
     Docs: man:systemd-sysv-generator(8)
  Process: 548 ExecStop=/etc/init.d/weewx stop (code=exited, status=0/SUCCESS)
  Process: 692 ExecStart=/etc/init.d/weewx start (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/weewx.service

Sep 01 09:14:20 raspberrypi python3[727]: weewx[727] CRITICAL __main__:     ****      self.loadServices(config_dict)
Sep 01 09:14:20 raspberrypi python3[727]: weewx[727] CRITICAL __main__:     ****    File "/usr/share/weewx/weewx/engine.py", line 138, in loadServices
Sep 01 09:14:20 raspberrypi python3[727]: weewx[727] CRITICAL __main__:     ****      obj = weeutil.weeutil.get_object(svc)(self,config_dict)
Sep 01 09:14:20 raspberrypi python3[727]: weewx[727] CRITICAL __main__:     ****    File "/usr/share/weewx/weeutil/weeutil.py", line 1093, in get_object
Sep 01 09:14:20 raspberrypi python3[727]: weewx[727] CRITICAL __main__:     ****      mod = __import__(module)
Sep 01 09:14:20 raspberrypi python3[727]: weewx[727] CRITICAL __main__:     ****    File "/usr/share/weewx/user/opsgenie.py", line 61
Sep 01 09:14:20 raspberrypi python3[727]: weewx[727] CRITICAL __main__:     ****      except KeyError, e:
Sep 01 09:14:20 raspberrypi python3[727]: weewx[727] CRITICAL __main__:     ****                     ^
Sep 01 09:14:20 raspberrypi python3[727]: weewx[727] CRITICAL __main__:     ****  SyntaxError: invalid syntax
Sep 01 09:14:20 raspberrypi python3[727]: weewx[727] CRITICAL __main__:     ****  Exiting.
pi@raspberrypi:~ $ sudo /etc/init.d/weewx start
[ ok ] Starting weewx (via systemctl): weewx.service.
pi@raspberrypi:~ $ sudo systemctl status weewx
● weewx.service - LSB: weewx weather system
   Loaded: loaded (/etc/init.d/weewx; generated; vendor preset: enabled)
   Active: active (exited) since Tue 2020-09-01 09:14:20 BST; 4h 58min ago
     Docs: man:systemd-sysv-generator(8)
  Process: 548 ExecStop=/etc/init.d/weewx stop (code=exited, status=0/SUCCESS)
  Process: 692 ExecStart=/etc/init.d/weewx start (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/weewx.service

Sep 01 09:14:20 raspberrypi python3[727]: weewx[727] CRITICAL __main__:     ****      self.loadServices(config_dict)
Sep 01 09:14:20 raspberrypi python3[727]: weewx[727] CRITICAL __main__:     ****    File "/usr/share/weewx/weewx/engine.py", line 138, in loadServices
Sep 01 09:14:20 raspberrypi python3[727]: weewx[727] CRITICAL __main__:     ****      obj = weeutil.weeutil.get_object(svc)(self,config_dict)
Sep 01 09:14:20 raspberrypi python3[727]: weewx[727] CRITICAL __main__:     ****    File "/usr/share/weewx/weeutil/weeutil.py", line 1093, in get_object
Sep 01 09:14:20 raspberrypi python3[727]: weewx[727] CRITICAL __main__:     ****      mod = __import__(module)
Sep 01 09:14:20 raspberrypi python3[727]: weewx[727] CRITICAL __main__:     ****    File "/usr/share/weewx/user/opsgenie.py", line 61
Sep 01 09:14:20 raspberrypi python3[727]: weewx[727] CRITICAL __main__:     ****      except KeyError, e:
Sep 01 09:14:20 raspberrypi python3[727]: weewx[727] CRITICAL __main__:     ****                     ^
Sep 01 09:14:20 raspberrypi python3[727]: weewx[727] CRITICAL __main__:     ****  SyntaxError: invalid syntax
Sep 01 09:14:20 raspberrypi python3[727]: weewx[727] CRITICAL __main__:     ****  Exiting.


Tom Keffer

unread,
Sep 1, 2020, 10:36:48 AM9/1/20
to weewx-user
So, the log does say something! The extension 'opsgenie' has not been ported to Python 3.

Season Ticket

unread,
Sep 1, 2020, 11:16:22 AM9/1/20
to weewx-user
I've removed Opsgenie from the service list.  however I still get nothing in the logs via the daemon.  if you notice the time stamps at the end of each log are the same
"Sep 01 09:14:20 raspberrypi python3[727]: weewx[727] CRITICAL __main__:     ****  Exiting.  "  - in both cases.

Tom Keffer

unread,
Sep 1, 2020, 2:04:53 PM9/1/20
to weewx-user
But PID 727 is the old instance, which still ran opsgenie. We want to see what happens without opsgenie. 

Try it again. This time, follow the directions in the Wiki article Help! Posting to weewx-user, except for step #6, start weewxd using

sudo /etc/init.d/weewx start

-tk

bgra...@umw.edu

unread,
Sep 1, 2020, 2:28:08 PM9/1/20
to weewx-user
Hello,
Seeing the discussion of python3, I thought I would do the switch myself but ran into some errors. See below:

+++++++++++++++++++++++++++++++
/var/log/weewx.log:
Sep  1 11:51:21 n4mrv weewx[3283] INFO __main__: Initializing weewx version 4.1.1
Sep  1 11:51:21 n4mrv weewx[3283] INFO __main__: Using Python 3.6.9 (default, Jul 17 2020, 12:50:27) #012[GCC 8.4.0]
Sep  1 11:51:21 n4mrv weewx[3283] INFO __main__: Platform Linux-4.15.0-115-generic-x86_64-with-Ubuntu-18.04-bionic
Sep  1 11:51:21 n4mrv weewx[3283] INFO __main__: Locale is 'en_US.UTF-8'
Sep  1 11:51:21 n4mrv weewx[3283] INFO __main__: Using configuration file /home/weewx/weewx.conf
Sep  1 11:51:21 n4mrv weewx[3283] INFO __main__: Debug is 0
Sep  1 11:51:21 n4mrv weewx[3283] INFO weewx.engine: Loading station type Vantage (weewx.drivers.vantage)
Sep  1 11:51:21 n4mrv weewx[3283] INFO weewx.engine: StdConvert target unit is 0x1
Sep  1 11:51:21 n4mrv weewx[3283] INFO weewx.wxservices: The following values will be calculated: pressure=prefer_hardware, barometer=prefer_hardware, altimeter=prefer_hardware, windchill=prefer_hardware, heatindex=prefer_hardware, dewpoint=prefer_hardware, inDewpoint=prefer_hardware, rainRate=prefer_hardware, maxSolarRad=prefer_hardware, cloudbase=prefer_hardware, humidex=prefer_hardware, appTemp=prefer_hardware, ET=prefer_hardware, windrun=prefer_hardware
Sep  1 11:51:21 n4mrv weewx[3283] INFO weewx.wxservices: The following algorithms will be used for calculations: altimeter=aaASOS, maxSolarRad=RS
Sep  1 11:51:21 n4mrv weewx[3283] CRITICAL __main__: Caught unrecoverable exception:
Sep  1 11:51:21 n4mrv weewx[3283] CRITICAL __main__:     ****  invalid syntax (cmon.py, line 315)
Sep  1 11:51:21 n4mrv weewx[3283] CRITICAL __main__:     ****  Traceback (most recent call last):
Sep  1 11:51:21 n4mrv weewx[3283] CRITICAL __main__:     ****    File "./bin/weewxd", line 148, in main
Sep  1 11:51:21 n4mrv weewx[3283] CRITICAL __main__:     ****      engine = weewx.engine.StdEngine(config_dict)
Sep  1 11:51:21 n4mrv weewx[3283] CRITICAL __main__:     ****    File "/home/weewx/bin/weewx/engine.py", line 75, in __init__
Sep  1 11:51:21 n4mrv weewx[3283] CRITICAL __main__:     ****      self.loadServices(config_dict)
Sep  1 11:51:21 n4mrv weewx[3283] CRITICAL __main__:     ****    File "/home/weewx/bin/weewx/engine.py", line 138, in loadServices
Sep  1 11:51:21 n4mrv weewx[3283] CRITICAL __main__:     ****      obj = weeutil.weeutil.get_object(svc)(self,config_dict)
Sep  1 11:51:21 n4mrv weewx[3283] CRITICAL __main__:     ****    File "/home/weewx/bin/weeutil/weeutil.py", line 1093, in get_object
Sep  1 11:51:21 n4mrv weewx[3283] CRITICAL __main__:     ****      mod = __import__(module)
Sep  1 11:51:21 n4mrv weewx[3283] CRITICAL __main__:     ****    File "/home/weewx/bin/user/cmon.py", line 315
Sep  1 11:51:21 n4mrv weewx[3283] CRITICAL __main__:     ****      except (ValueError, IOError, KeyError), e:
Sep  1 11:51:21 n4mrv weewx[3283] CRITICAL __main__:     ****                                            ^
Sep  1 11:51:21 n4mrv weewx[3283] CRITICAL __main__:     ****  SyntaxError: invalid syntax
Sep  1 11:51:21 n4mrv weewx[3283] CRITICAL __main__:     ****  Exiting.
+++++++++++++++++++++++++++++++

weewx 4.1.1 was running fine (VantagePro2) with Python 2.7.17. I installed the prerequisites for python3 (3.6.9) according to your instructions in the guide and then from the 4.1.1 directory ran python3 ./setup build and install. No errors noticed until I restarted weewx and got the above errors before it exited.

I'm not much of a programmer so I really don't see what happened here and would appreciate it if some one could point out what I either did wrong or haven't done enough of.

Thanks.
Bob Grattan
http://grattans.org/wx

Tom Keffer

unread,
Sep 1, 2020, 2:32:49 PM9/1/20
to weewx-user
Same issue, except this time, it's cmon. Your version has not been ported to Python 3. Fortunately, a newer version is available which has.

wwwd...@gmail.com

unread,
Sep 1, 2020, 2:50:51 PM9/1/20
to weewx-user
I just went through the same thing, as was mentioned above make sure all of your plugins have been updated to the latest version. I had a few plugins that I no longer run as they hadn't been upgraded and after a look at the code the work to upgrade them was more than I was willing to tackle. WeeWX-WD for example (although someone has a work-in-progress repo where it's being worked on, but doesn't have any releases yet -- I did an install from a GitHub clone and it seems to be working so far).

At least for the two simple plugins I wrote I just had to change Queue to queue and replace urllib2 with urllib.request.

bgra...@umw.edu

unread,
Sep 1, 2020, 5:01:03 PM9/1/20
to weewx-user
Thanks to everyone for the help.
Bob

Timothy Buchanan

unread,
Sep 2, 2020, 5:34:28 PM9/2/20
to weewx-user
I tried this procedure, and with python3 I get an error that Cheetah is not found. Log extract:

Sep  2 15:28:18 raspberrypi weewx[1426] CRITICAL __main__: Caught unrecoverable exception:
Sep  2 15:28:18 raspberrypi weewx[1426] CRITICAL __main__:     ****  No module named 'Cheetah'
Sep  2 15:28:18 raspberrypi weewx[1426] CRITICAL __main__:     ****  Traceback (most recent call last):
Sep  2 15:28:18 raspberrypi weewx[1426] CRITICAL __main__:     ****    File "/usr/share/weewx/weewxd", line 148, in main
Sep  2 15:28:18 raspberrypi weewx[1426] CRITICAL __main__:     ****      engine = weewx.engine.StdEngine(config_dict)
Sep  2 15:28:18 raspberrypi weewx[1426] CRITICAL __main__:     ****    File "/usr/share/weewx/weewx/engine.py", line 75, in __init__
Sep  2 15:28:18 raspberrypi weewx[1426] CRITICAL __main__:     ****      self.loadServices(config_dict)
Sep  2 15:28:18 raspberrypi weewx[1426] CRITICAL __main__:     ****    File "/usr/share/weewx/weewx/engine.py", line 138, in loadServices
Sep  2 15:28:18 raspberrypi weewx[1426] CRITICAL __main__:     ****      obj = weeutil.weeutil.get_object(svc)(self,config_dict)
Sep  2 15:28:18 raspberrypi weewx[1426] CRITICAL __main__:     ****    File "/usr/share/weewx/weeutil/weeutil.py", line 1093, in get_object
Sep  2 15:28:18 raspberrypi weewx[1426] CRITICAL __main__:     ****      mod = __import__(module)
Sep  2 15:28:18 raspberrypi weewx[1426] CRITICAL __main__:     ****    File "/usr/share/weewx/user/forecast.py", line 556, in <module>
Sep  2 15:28:18 raspberrypi weewx[1426] CRITICAL __main__:     ****      from weewx.cheetahgenerator import SearchList
Sep  2 15:28:18 raspberrypi weewx[1426] CRITICAL __main__:     ****    File "/usr/share/weewx/weewx/cheetahgenerator.py", line 66, in <module>
Sep  2 15:28:18 raspberrypi weewx[1426] CRITICAL __main__:     ****      import Cheetah.Filters
Sep  2 15:28:18 raspberrypi weewx[1426] CRITICAL __main__:     ****  ModuleNotFoundError

Weewx version is 4.1.1. Do I need to install a new version of Cheetah? If so, how? All is working under python2. Thanks.

Tom Keffer

unread,
Sep 2, 2020, 7:12:04 PM9/2/20
to weewx-user
You need Python 3 versions of all the prerequisites. To install them, follow step 1 (and only step 1) from the setup.py instructions.

Timothy Buchanan

unread,
Sep 3, 2020, 2:45:27 PM9/3/20
to weewx-user
Thanks; that fixed the problem with Cheetah. I still have a problem with the skin I'm using (exfoliation), but that's for another thread.

Season Ticket

unread,
Sep 5, 2020, 12:52:56 PM9/5/20
to weewx-user
My upgrade to python3 is still causing me a few problems.  I finally managed to get weewx to start after removing weewx and re-installing it.  For some reason, despite saying that it would use my previous config,  it changed the driver back to Simulator.  I'm using HP1000.py (Aussie Susan's driver) which is now causing me problems.

see https://github.com/AussieSusan/HP1000/issues/6 - if anyone knows how to fix "Error #1" please help

steeple ian

unread,
Sep 5, 2020, 12:57:05 PM9/5/20
to weewx...@googlegroups.com
HP1000 driver has not yet been ported to Python3

steeple ian

unread,
Sep 5, 2020, 1:18:36 PM9/5/20
to weewx...@googlegroups.com
The three options you have are to go back to Python2 until the driver has been updated or there may be a willing person able to help you update the driver yourself. There are some fantastically helpful people in this group who may be very willing. The third option is to use the interceptor driver which should also work (from memory) which is Python3 compliant.
IM

Susan Mackay

unread,
Sep 6, 2020, 10:37:47 PM9/6/20
to weewx-user
I'm working on it and it is being tested as time permits.
Susan

Bob Grattan

unread,
Sep 7, 2020, 4:39:00 PM9/7/20
to weewx-user
Having another problem with the move to python3. This time it's the weewx-emoncms extension. I have installed the latest version which should run on python3, from what I understand.
At bootup, I get the normal:

Sep  7 16:04:07 n4mrv wee_reports[27467] INFO user.emoncms: service version is 0.17
Sep  7 16:04:07 n4mrv wee_reports[27467] INFO user.emoncms: node is 0
Sep  7 16:04:07 n4mrv wee_reports[27467] INFO user.emoncms: Data will be uploaded with token=XXXXXXXXXXXXXXXXXXXXXXXXXXXXb634

In weewx.config I have:

[StdRESTful]
  [[EmonCMS]]
        url = http://192.168.1.103/emoncms/input/post.json    
        token = XXXXXXXXXXXXXXXXXXXXXXXXXXXXb634

But I get:
weewx.log:
Sep  7 16:15:16 n4mrv weewx[27417] DEBUG weewx.restx: EmonCMS: Failed upload attempt 1: Server returned 'b'ok''
Sep  7 16:15:21 n4mrv weewx[27417] DEBUG weewx.restx: EmonCMS: Failed upload attempt 2: Server returned 'b'ok''
Sep  7 16:15:26 n4mrv weewx[27417] DEBUG weewx.restx: EmonCMS: Failed upload attempt 3: Server returned 'b'ok''
Sep  7 16:15:26 n4mrv weewx[27417] ERROR weewx.restx: EmonCMS: Failed to publish record 2020-09-07 16:15:00 EDT (1599509700): Failed upload after 3 tries

It was working fine in python2. The token and local server are the same and correct. I'm not sure I understand the debug error. Can anyone help?  Thanks in advance.
Bob

bgra...@umw.edu

unread,
Sep 7, 2020, 6:17:59 PM9/7/20
to weewx-user
To add to this, it seems my local server is being updated correctly as before even though the 3 failed attempts still appear in the log. Is it possible that the software is also trying to send data to emoncms.org? I only send data to my local server so could there be some code I need to remove to not keep it from sending it to emoncms.org

Tom Keffer

unread,
Sep 7, 2020, 6:47:54 PM9/7/20
to weewx-user
In the file emoncms.py, try changing lines 290-293 from

    def check_response(self, response):
        txt = response.read()
        if txt != 'ok' :
            raise weewx.restx.FailedPost("Server returned '%s'" % txt)

to

    def check_response(self, response):
        txt = response.read().decode()
        if txt != u'ok' :
            raise weewx.restx.FailedPost("Server returned '%s'" % txt)

Tom Keffer

unread,
Sep 7, 2020, 6:49:35 PM9/7/20
to weewx-user
There are now three, unrelated, support issues scrambled together in this thread.

If you are having problems transitioning from Python 2 to Python 3, please start a new thread! It's getting terribly confusing untangling the responses.

bgra...@umw.edu

unread,
Sep 8, 2020, 9:42:17 AM9/8/20
to weewx-user
Thanks, Tom, that seems to have fixed it. Sorry to have added to the confused thread.  Bob
Reply all
Reply to author
Forward
0 new messages