Problem with extension install (SyntaxError: Non-ASCII character)

263 views
Skip to first unread message

Christian Gruber

unread,
Feb 19, 2021, 5:01:48 AM2/19/21
to weewx-user
hello,

i am trying to install this extension to use it with my weatherlink-live

it fails with the following error:

######################################
Request to install 'release.zip'
Extracting from zip archive release.zip
Traceback (most recent call last):
  File "/usr/share/weewx/wee_extension", line 88, in <module>
    main()
  File "/usr/share/weewx/wee_extension", line 80, in main
    ext.install_extension(options.install)
  File "/usr/share/weewx/weecfg/extension.py", line 125, in install_extension
    self.install_from_dir(extension_dir)
  File "/usr/share/weewx/weecfg/extension.py", line 147, in install_from_dir
    extension_dir)
  File "/usr/share/weewx/weecfg/__init__.py", line 1866, in get_extension_installer
    __import__('install')
  File "/var/tmp/weewx-weatherlink-live-release/install.py", line 1
SyntaxError: Non-ASCII character '\xc2' in file /var/tmp/weewx-weatherlink-live-release/install.py on line 1, but no encoding declared; see http://python.oev/peps/pep-0263/ for details
######################################

maybe someone can help me :)

regards
chris

Tom Keffer

unread,
Feb 19, 2021, 8:09:18 AM2/19/21
to weewx-user
The problem is that the extension author used the copyright character ('©') in the first line of the code for install.py, which is a non-ascii character. In Python 2.x, the default encoding of source code is ascii. If non-ascii characters are going to be used, then the encoding must be declared, which the author did not do. In Python 3.x, the default encoding is utf-8, so the copyright character will work.

The fix is to either remove the character, or switch to Python 3.x. Or, contact the author.

--
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/17172c68-ef7b-4d29-a23d-06caf60b4de9n%40googlegroups.com.

Christian Gruber

unread,
Feb 19, 2021, 1:31:26 PM2/19/21
to weewx-user
thank you, this solved the problem :)

Michael Schantl

unread,
Feb 19, 2021, 2:00:51 PM2/19/21
to weewx-user
As far as I can see, you are using Python 2 or this problem occurs only with this version.
However, the plugin is unfortunately only compatible with Python 3, as it also uses some other Py 3-only features.

regards,
Michael

Christian Gruber

unread,
Feb 20, 2021, 5:52:18 AM2/20/21
to weewx-user
hello michael,

you are right - install worked now, but i get an error in syslog.

how can i tell my pi to use python3 instead of python2?

regards,
chris 

Michael Schantl

unread,
Feb 20, 2021, 6:42:25 AM2/20/21
to weewx-user

Hi Chris,

I guess you followed the documentation for installing on a Pi?
http://www.weewx.com/docs/debian.htm

In that case first uninstall WeeWX {should keep configuration}:

   sudo apt remove weewx

Also keep in mind that the WLL driver uses the Python requests library. Install it using:

   sudo apt install python3-requests

Then re-install according to the page linked above. In the first section only run the command that's labeled "For Debian10 and later, use python3". Skip the following line for Python 2.
Follow all other sections as usual.

Tom Keffer

unread,
Feb 20, 2021, 8:16:46 AM2/20/21
to weewx-user
You do not need to uninstall weewx first. 

Just follow the install instructions, but use the python3 version instead:

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



Christian Gruber

unread,
Feb 20, 2021, 11:04:59 AM2/20/21
to weewx-user
hello,

thank you, i reinstalled it and it's running now :)

i have a few additional questions:

-) should the pi and weatherlink live be on the same subnetwork, because i dont get data

-) why should i switch to WLL schema, i loose specific data, when i dont do it?

regards,
chris

Michael Schantl

unread,
Feb 20, 2021, 1:55:10 PM2/20/21
to weewx-user
should the pi and weatherlink live be on the same subnetwork, because i dont get data

Yes, to receive the live 2.5 second push updates (wind, rain) both devices must be on the same subnet. They work using UDP broadcasts. The "complete" data set (HTTP) doesn't technically require it, though I haven't tested whether the driver works fine if it never receives a push update (it should).


why should i switch to WLL schema, i loose specific data, when i dont do it?
 
The following columns are added in the WLL schema:
  • dewpoint and heatindex for up to 9 sensors (default only for 2)
  • wetbulb temperature
  • THW and THSW index ("feels like" temperature)
  • indoor heatindex
  • "rainCount": how often your rain sensor's spoon got tripped since the last update
  • "rainCountRate": the current rate of spoon tripping
  • "rainSize": the size of the rain sensor spoon in inches (as configured in the WLL app or the WeatherLink.com website)
Additionally, daily summaries and units are configured for all new columns (except the last one).


regards, Michael

mbat...@gmail.com

unread,
Feb 20, 2021, 9:39:09 PM2/20/21
to weewx-user
UDP broadcasts are not routed between subnets, so unless your weewx host has a presence on the weatherlink hub's net, it won't "hear" the hub.

There are a couple of ways (besides "multi-homing" the weewx box) to deal with the problem. Ass u me ing your home firewall / router is a Linux box, and that you have administrative control of it, one solution is to install a UDP replicator (such as this one) on your home router.  Another method (same assumptions) is to use port forwarding, which is described here.

Christian Gruber

unread,
Feb 21, 2021, 2:46:12 AM2/21/21
to weewx-user
hello,

thank you for this information about schema and UDP.

i use a mikrotik rb4011igs, so i think this should be possible, i will look for a solution and post it here.

regards,
chris

Christian Gruber

unread,
Feb 23, 2021, 5:04:56 AM2/23/21
to weewx-user
hello,

put my RPI now to the same subnet, and i get data.

i also switched schema in weewx.conf to user.weatherlink_live.schema and restarted the service

do i have to create a new database then, like its written here http://www.weewx.com/docs/customizing.htm#archive_database 
or is this not necessary?

regards,
chris

Michael Schantl

unread,
Feb 23, 2021, 8:23:11 AM2/23/21
to weewx-user
Yes, a new db needs to be created. You could also configure a second db manually, let WeeWX populate the schema and then transfer all data using wee_database --transfer
But the effort is mostly the same either way, so it's easier to just follow the documentation.

Christian Gruber

unread,
Feb 25, 2021, 8:59:03 AM2/25/21
to weewx-user
thx michael, works fine now :)
Reply all
Reply to author
Forward
0 new messages