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())



On Thu, Jan 2, 2020 at 1:30 PM Jaap de Munck <[email protected]> wrote:

> 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:
>>
>> 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
>>
>>
>> On Mon, Dec 23, 2019 at 3:46 PM Jaap de Munck <[email protected]> wrote:
>>
>>> 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
>>>
>>> --
>>> 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 [email protected].
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/weewx-development/a160e60b-57fd-444f-bfb2-7bb9fb139366%40googlegroups.com
>>> <https://groups.google.com/d/msgid/weewx-development/a160e60b-57fd-444f-bfb2-7bb9fb139366%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
> 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/weewx-development/679a0365-7b70-4915-b7b7-0bc0f0ad8a83%40googlegroups.com
> <https://groups.google.com/d/msgid/weewx-development/679a0365-7b70-4915-b7b7-0bc0f0ad8a83%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-development/CAPq0zEBD73cVONj0VDFwhR43imkyzWWKMcLhS9UDw1fKMhOq6Q%40mail.gmail.com.

Reply via email to