WeeWx 4 and 1-wire

116 views
Skip to first unread message

Jaap de Munck

unread,
Dec 23, 2019, 5:46:16 PM12/23/19
to weewx-development
Hello,
 
No problems with Vantage (Pro) and Weewx 4!
But I also have a 1-wire sensor. OWFS isn't Python3 ready yet, so I tried to do that myself.
The result seemed not so bad. It is running on Python3!
It's also running on Python2.7: I copied it back to the 'production' system running weewx 3.9.2.
Later the Weewx 4 test environment was switched back to Python2 resulting in:

CRITICAL weewx.engine: Caught unrecoverable exception:
CRITICAL weewx.engine:     ****  in method 'init', argument 1 of type 'char const *'
CRITICAL weewx.engine:     ****  Traceback (most recent call last):
CRITICAL weewx.engine:     ****    File "/home/weewx/bin/weewx/engine.py", line 886, in main
CRITICAL weewx.engine:     ****      engine = StdEngine(config_dict)
CRITICAL weewx.engine:     ****    File "/home/weewx/bin/weewx/engine.py", line 83, in __init__
CRITICAL weewx.engine:     ****      self.loadServices(config_dict)
CRITICAL weewx.engine:     ****    File "/home/weewx/bin/weewx/engine.py", line 143, in loadServices
CRITICAL weewx.engine:     ****      obj = weeutil.weeutil.get_object(svc)(self,config_dict)
CRITICAL weewx.engine:     ****    File "/home/weewx/bin/user/owfs.py", line 488, in __init__
CRITICAL weewx.engine:     ****      ow.init(self.interface)
CRITICAL weewx.engine:     ****    File "/usr/lib/python2.7/dist-packages/ow/__init__.py", line 220, in init
CRITICAL weewx.engine:     ****      if not _OW.init( iface ):
CRITICAL weewx.engine:     ****  TypeError: in method 'init', argument 1 of type 'char const *'
CRITICAL weewx.engine:     ****  Exiting.

The logging (attached) is from a (virtual) Debian10 environment and Weewx4 + Simulator driver. But it also occurs with Ubuntu 19.04 and Weewx4 + Vantage driver.

Best wishes,
Jaap

syslog-w4-deb10-python3.7+ow.txt
weewx.conf
owfs.py
syslog-w4-deb10-python2.7+ow.txt

Thomas Keffer

unread,
Dec 23, 2019, 7:50:40 PM12/23/19
to Jaap de Munck, weewx-development
I'm just guessing, but you could try to change line 488 in owfs.py from this
ow.init(self.interface)
to this
ow.init(self.interface.encode())
-tk

--
You received this message because you are subscribed to the Google Groups "weewx-development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-developm...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-development/a160e60b-57fd-444f-bfb2-7bb9fb139366%40googlegroups.com.
Message has been deleted

Jaap de Munck

unread,
Jan 2, 2020, 3:30:44 PM1/2/20
to weewx-development
Hi Tom,

Thanks for your quick reaction (mine took a bit too long).

Good guess, you were right..
With a special treatment for Python2 like

        if six.PY2: 
            ow.init(self.interface.encode())
        else:
            ow.init(self.interface)

It runs on all (Weewx4-python3; Weewx4-python2.7 and Weewx3.9-python2.7)

Here is the new version (attached).

Jaap


Op dinsdag 24 december 2019 01:50:40 UTC+1 schreef Tom Keffer:
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-de...@googlegroups.com.
owfs.py

Thomas Keffer

unread,
Jan 2, 2020, 3:56:47 PM1/2/20
to Jaap de Munck, weewx-development
Glad that's working out. Unfortunately, we can't always depend on six being around when running under Python 2. 

Another option would be

try:
    ow.init(self.interface)
except TypeError:
    ow.init(self.interface.encode())



To unsubscribe from this group and stop receiving emails from it, send an email to weewx-developm...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-development/679a0365-7b70-4915-b7b7-0bc0f0ad8a83%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages