Weewx5 upgrade "File "/usr/share/weewx/weectl.py", line 50" error

145 views
Skip to first unread message

Simon Ranson

unread,
Jan 30, 2024, 5:51:42 AMJan 30
to weewx-user
Hi All,

I wonder if anybody can assist with an issue I'm having while upgrading to version 5?

After running "sudo apt install weewx" I get the following error:

Setting up weewx (5.0.0-1) ...
Using root:root as user:group
  File "/usr/share/weewx/weectl.py", line 50
    version=f"weectl {weewx.__version__}")
                                        ^
SyntaxError: invalid syntax
dpkg: error: --compare-versions takes three arguments: <version> <relation> <version>

Type dpkg --help for help about installing and deinstalling packages [*];
Use 'apt' or 'aptitude' for user-friendly package management;
Type dpkg -Dhelp for a list of dpkg debug flag values;
Type dpkg --force-help for a list of forcing options;
Type dpkg-deb --help for help about manipulating *.deb files;

Options marked [*] produce a lot of output - pipe it through 'less' or 'more' !
Using debconf configuration values from previous install
  File "/usr/share/weewx/weectl.py", line 50
    version=f"weectl {weewx.__version__}")
                                        ^
SyntaxError: invalid syntax
dpkg: error processing package weewx (--configure):
 installed weewx package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 weewx
E: Sub-process /usr/bin/dpkg returned an error code (1)


Has anybody got a work-around for this? I do have a backup of my v4 database, so can do a fresh install if it comes to that.

Many thanks
Simon

matthew wall

unread,
Jan 30, 2024, 10:00:41 AMJan 30
to weewx-user
simon,

please tell us about your system.  what operating system and version?  which python are you using?  what did you do between a stable v4 installation and the attempted installation of v5?

m

matthew wall

unread,
Jan 30, 2024, 10:57:26 AMJan 30
to weewx-user
simon,

please post the contents of /etc/default/weewx

you are probably experiencing the behavior reported in this issue:


m

Simon Ranson

unread,
Jan 31, 2024, 4:35:09 AMJan 31
to weewx-user
Matthew,

Many thanks for your reply.

it does look like I'm having the same issue as described in the link you posted - I searched high and low for similar issues but that one passed me by. My /etc/default/weewx file does contain the "python2" value.

WEEWX_PYTHON=python2
WEEWX_PYTHON_ARGS=
WEEWX_BINDIR=/usr/share/weewx
WEEWX_BIN=/usr/bin/weewxd
WEEWX_CFG=/etc/weewx/weewx.conf


As a bit of background. I'm running Weewx on a Raspberry Pi 3 Model B Plus Rev 1.3 (5.1.103-v7+) running Debian 11.1.

I followed the upgrade steps as per https://weewx.com/docs/5.0/quickstarts/debian/#upgrade. The install progressed okay, with the text UI showing asking me to set the station location/coordinates/website and select the weather station driver and also asked if I wanted to overwrite the weewx.conf file. After that it errored out.

I have modified the "WEEWX_PYTHON=python2" line to be "python3" and now the install progresses further, however no getting 

Setting up weewx (5.0.0-1) ...
Using root:root as user:group
Using debconf configuration values from previous install
usage: weectl.py -v|--version
       weectl.py -h|--help
       weectl.py database --help
       weectl.py debug --help
       weectl.py device --help
       weectl.py extension --help
       weectl.py import --help
       weectl.py report --help
       weectl.py station --help
weectl.py: error: unrecognized arguments: │ │

dpkg: error processing package weewx (--configure):
 installed weewx package post-installation script subprocess returned error exit status 2

Errors were encountered while processing:
 weewx
E: Sub-process /usr/bin/dpkg returned an error code (1)


I'll work on this one separately.

Thanks again for you help, and great software!

Cheers
Simon

matthew wall

unread,
Jan 31, 2024, 3:23:36 PMJan 31
to weewx-user
On Wednesday, January 31, 2024 at 4:35:09 AM UTC-5 simonj...@gmail.com wrote:
I have modified the "WEEWX_PYTHON=python2" line to be "python3" and now the install progresses further, however no getting 

Setting up weewx (5.0.0-1) ...
Using root:root as user:group
Using debconf configuration values from previous install
usage: weectl.py -v|--version
       weectl.py -h|--help
       weectl.py database --help
       weectl.py debug --help
       weectl.py device --help
       weectl.py extension --help
       weectl.py import --help
       weectl.py report --help
       weectl.py station --help
weectl.py: error: unrecognized arguments: │ │

dpkg: error processing package weewx (--configure):
 installed weewx package post-installation script subprocess returned error exit status 2

Errors were encountered while processing:
 weewx
E: Sub-process /usr/bin/dpkg returned an error code (1)

I'll work on this one separately.

this is now a separate problem.  now the version tags in weewx.conf are not evaluating as expected (could me many reasons for this), so the fallback is to provision a new weewx.conf using values from debconf.  but it looks like your debconf is not fully populated, so the call to weectl fails.

it could be pretty tricky to figure out how it got into this state.  but check the 'version' in /etc/weewx.conf - that won't give us a definitely answer, but it might provide a clue.

to extract yourself, do a remove of weewx (not a purge!!)

sudo apt remove weewx

then install v5 again.

the remove should leave your database (/var/lib/weewx) and configurations (/etc/weewx) intact.  but make a copy of those directories before doing the remove, just to be safe.

Reply all
Reply to author
Forward
0 new messages