Luc,

You are very close to having a code base that will run under both Python 2
and 3. Suggestions:

1. Put this at the top to cover your use of multiple arguments to "print":

from __future__ import print_function

2. For a queue, do this:

try:
    # Python 2
    from Queue import Queue
except ImportError:
    # Python 3
    from queue import Queue

Then use "Queue" throughout your code.

3. Your use of "strerror" is non-standard. Instead of this:

   except ValueError as e:
       logerr('thermistor_temp failed for temp_raw %s r (k ohm) %s'
              'error: %s' % (temp_raw, r, e.strerror))

do this:

   except ValueError as e:
       logerr('thermistor_temp failed for temp_raw %s r (k ohm) %s'
              'error: %s' % (temp_raw, r, e))

That's it!

-tk

On Mon, Mar 25, 2019 at 5:15 AM <[email protected]> wrote:

> On Sunday, 24 March 2019 20:02:49 UTC-3, Tom Keffer wrote:
>>
>> Your choices:
>>
> Do a global install, much like we do with Python 2.x. Instructions are in
> the setup.py guide in the development branch. I've also pasted it below.
>
> Tom,
>
> Attached the results of the conversion to python3 of the weewx-rtld driver.
>
> Luc
>

Reply via email to