python interceptor module not working after v5 upgrade

66 views
Skip to first unread message

Owen

unread,
Jan 25, 2024, 6:15:54 AM1/25/24
to weewx-user
Just upgraded to v5 and everything works as it should except my interceptor module.

Long story short....my barometer module is broken and returns ridiculous values that bork the normal weewx calculations, so I've been using an interceptor to check the database entry after every new archive record is written, and run a shell script that changes these crazy values to one that I suck down off the internet.
This has been working for a long time now.

"weewx.conf" relevant entry/lines:
[Engine]
    [[Services]]
        report_services = user.barometerfudge.MungeBarometer, weewx.engine.StdPrint, weewx.engine.StdReport, user.lowBattery.BatteryAlarm

Module name in ~/bin/user :
-rw-r--r-- 1 weewx weewx   1172 Jan 25 21:20 barometerfudge.py

Contents:
import subprocess
import weewx
from weewx.engine import StdService

class MungeBarometer(StdService):

    def __init__(self, engine, config_dict):
        super(MungeBarometer, self).__init__(engine, config_dict)
        self.bind(weewx.NEW_ARCHIVE_RECORD, self.new_archive_record)

    def new_archive_record(self, event):
        subprocess.call(["/home/weewx/check_fix_pressure.sh"])

I have also tried using 'subprocess.run', but same result.

There are a couple of other python modules in ~/bin/user and they are being run fine, so there's not a permission issue.  Nothing else has changed.

No errors appear in the log even when debug=1, there is simply no output from that script at all meaning that it's not being run.  I updated it to create a 'logger' entry when it starts, and it works if I run it manually so I know that it's not being called by weewx.

The compiled python is being generated/updated in __pycache__ when weewx is restarted.

Does using a "virtual python environment' prevent the execution of shell scripts in discreet directories further up the directory structure?  I would have thought I'd see an error in the log if that were the case.

Any other clues/ideas appreciated.

Cheers...Owen

Owen

unread,
Jan 25, 2024, 6:26:28 AM1/25/24
to weewx-user
Apologies - if not already obvious I upgraded using the pip method, replacing the old 'setup.py'.

Reply all
Reply to author
Forward
0 new messages