upgrade from weewx 3.9.2 to 4.1.1 doesn't work ...

234 views
Skip to first unread message

Jlou 43

unread,
Aug 4, 2020, 11:23:14 AM8/4/20
to weewx-user
Hello,

I've got a problem since I update Weewx from 3.9.2 to 4.1.1 : my web page isn't updated (only the graphs are) and here is what I find in my Syslog.log :

Aug  4 17:10:17 raspberrypi weewx[2682] ERROR weewx.cheetahgenerator: Generate failed with exception '<class 'NameMapper.NotFound'>'
Aug  4 17:10:17 raspberrypi weewx[2682] ERROR weewx.cheetahgenerator: **** Ignoring template /home/weewx/skins/Alf_normal/index.html.tmpl
Aug  4 17:10:17 raspberrypi weewx[2682] ERROR weewx.cheetahgenerator: **** Reason: cannot find 'has_key' while searching for 'has_key'
Aug  4 17:10:17 raspberrypi weewx[2682] ERROR weewx.cheetahgenerator: ****  Traceback (most recent call last):
Aug  4 17:10:17 raspberrypi weewx[2682] ERROR weewx.cheetahgenerator: ****    File "/home/weewx/bin/weewx/cheetahgenerator.py", line 322, in generate
Aug  4 17:10:17 raspberrypi weewx[2682] ERROR weewx.cheetahgenerator: ****      unicode_string = compiled_template.respond()
Aug  4 17:10:17 raspberrypi weewx[2682] ERROR weewx.cheetahgenerator: ****    File "_home_weewx_skins_Alf_normal_index_html_tmpl.py", line 1201, in respond
Aug  4 17:10:17 raspberrypi weewx[2682] ERROR weewx.cheetahgenerator: ****  NameMapper.NotFound: cannot find 'has_key' while searching for 'has_key'

Thank you for your help.

Tom Keffer

unread,
Aug 4, 2020, 11:28:55 AM8/4/20
to weewx-user
I would guess that you are using a search list extension that has not been ported to Python 3.

Try running Python 2. Or, see if there is an update for the extension.

--
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/d1c4583e-5053-4728-9baf-7f637a439991o%40googlegroups.com.

Jlou 43

unread,
Aug 4, 2020, 11:40:30 AM8/4/20
to weewx-user
Thank you for your answer, I think you are right I installed python 3 and shouldn't have, how can I go back to python 2 now?
Thank you.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx...@googlegroups.com.

Jlou 43

unread,
Aug 4, 2020, 11:54:49 AM8/4/20
to weewx-user
In fact it's python 2 running on my raspberry:

pi@raspberrypi:~ $ python -V
Python 2.7.16

Message has been deleted

Jlou 43

unread,
Aug 4, 2020, 12:15:07 PM8/4/20
to weewx-user
And this morning I made :

Prerequisites for Debian 10 (Buster), Raspbian 10, Ubuntu 18.04-19.10

sudo apt update

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

# This works for most installations...
sudo apt install python3-cheetah
# ... if not, try this:
sudo pip3 install Cheetah3

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

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


Jlou 43

unread,
Aug 4, 2020, 12:23:38 PM8/4/20
to weewx-user
I wonder if I will not reinstall weewx with the saved files and directories ...




Tom Keffer

unread,
Aug 4, 2020, 3:28:58 PM8/4/20
to weewx-user
Reinstalling will change nothing.

There is another option: change the templates, so they no longer use has_key() (which no longer exists in Python 3). Instead use the 'x in y' pattern. For example, you would change

#if $Extras.has_key('googleMapsDisplay')

to

#if 'googleMapsDisplay' in $Extras

Go through all the templates and hunt down all instances of has_key() and change accordingly. Note: they will not all look like my example.

Shouldn't take you more than 5 minutes.

-tk






On Tue, Aug 4, 2020 at 9:23 AM Jlou 43 <jlo...@gmail.com> wrote:
I wonder if I will not reinstall weewx with the saved files and directories ...




--
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/8901e6f0-dc91-482a-96bc-345aa00cd635o%40googlegroups.com.

Jlou 43

unread,
Aug 4, 2020, 5:13:53 PM8/4/20
to weewx-user
 Thanks for your reply, but I solved my problem by reinstalling this way:

3. Install WeeWX

After installing the prerequisites, you can install WeeWX itself.

  1. Expand the source archive:

    tar xvfz weewx-X.Y.Z.tar.gz
  2. Change directory into the expanded archive:

    cd weewx-X.Y.Z
  3. 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.

  4. Then build and install. Python 2 users: substitute python2 for python3.

    python3 ./setup.py build
    sudo python3 ./setup.py install
I replace python3 by python2 and now everything works perfectly, but if i have to switch to python3 your advice will be helpful.
Thank you.

geni08...@gmail.com

unread,
Aug 10, 2020, 1:02:42 PM8/10/20
to weewx-user
Update gets stuck with errors from missing packages
weewx1.jpg

Tom Keffer

unread,
Aug 10, 2020, 8:56:50 PM8/10/20
to weewx-user
(Please do not send a screen shot. They are hard to read, include only a few lines, and cannot be translated. Cut and paste instead.)

Did you do

sudo apt-get update

first?

--
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.

geni08...@gmail.com

unread,
Aug 11, 2020, 1:44:50 AM8/11/20
to weewx-user
I did this:
wget -qO - http://weewx.com/apt/weewx-python3.list | sudo tee /etc/apt/sources.list.d/weewx.list
sudo apt-get update
sudo apt-get upgrade
sudo apt install python3-mysqldb
sudo apt install python3-ephem
sudo apt-get update
sudo apt-get upgrade

Tom Keffer

unread,
Aug 11, 2020, 8:30:02 AM8/11/20
to weewx-user
I'm sorry: I just realized that your post is unrelated to the original post. We need some context to understand what you are trying to do. The screenshot you sent does not match your description of what you did. Are you truly upgrading? If so, from what version?

What happens when you do a simple install:

wget -qO - http://weewx.com/apt/weewx-python3.list | sudo tee /etc/apt/sources.list.d/weewx.list
sudo apt update
sudo apt install weewx

-tk

geni08...@gmail.com

unread,
Aug 11, 2020, 10:25:52 AM8/11/20
to weewx-user
pi@raspberrypi:~ $ sudo apt install weewx
Paketlisten werden gelesen... Fertig
Abhängigkeitsbaum wird aufgebaut.
Statusinformationen werden eingelesen.... Fertig
Einige Pakete konnten nicht installiert werden. Das kann bedeuten, dass
Sie eine unmögliche Situation angefordert haben oder, wenn Sie die
Unstable-Distribution verwenden, dass einige erforderliche Pakete noch
nicht erstellt wurden oder Incoming noch nicht verlassen haben.
Die folgenden Informationen helfen Ihnen vielleicht, die Situation zu lösen:

Die folgenden Pakete haben unerfüllte Abhängigkeiten:
 weewx : Hängt ab von: python3-cheetah ist aber nicht installierbar
E: Probleme können nicht korrigiert werden, Sie haben zurückgehaltene defekte Pakete.
pi@raspberrypi:~ $

Tom Keffer

unread,
Aug 11, 2020, 10:45:24 AM8/11/20
to weewx-user
What version of Rasbian are you running? 

cat /etc/os-release

-tk

Geni 0815

unread,
Aug 12, 2020, 1:07:29 AM8/12/20
to weewx-user

pi@raspberrypi:~ $ PRETTY_NAME="Raspbian GNU/Linux 9 (stretch)"

pi@raspberrypi:~ $ NAME="Raspbian GNU/Linux"

pi@raspberrypi:~ $ VERSION_ID="9"

pi@raspberrypi:~ $ VERSION="9 (stretch)"

pi@raspberrypi:~ $ VERSION_CODENAME=stretch

pi@raspberrypi:~ $ ID=raspbian

pi@raspberrypi:~ $ ID_LIKE=debian

pi@raspberrypi:~ $ HOME_URL="http://www.raspbian.org/"

pi@raspberrypi:~ $ SUPPORT_URL="http://www.raspbian.org/RaspbianForums"

pi@raspberrypi:~ $ BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

To unsubscribe from this group and stop receiving emails from it, send an email to weewx...@googlegroups.com.

Tom Keffer

unread,
Aug 12, 2020, 11:01:07 AM8/12/20
to weewx-user
As noted in the install page for Debian, for stretch (Debian 9), you need to use Python 2. So, you want

wget -qO - http://weewx.com/apt/weewx-python2.list | sudo tee /etc/apt/sources.list.d/weewx.list
sudo apt-get update
sudo apt-get install weewx

The reason is that not all packages are available for Python 3 on stretch. 

-tk



Geni 0815

unread,
Aug 14, 2020, 1:40:57 AM8/14/20
to weewx-user
Thanks for the help, it worked like this.
Reply all
Reply to author
Forward
0 new messages