I can't speak to the logic of the code, but it looks like it should work
under Python 2 and 3. A couple things to think about:
1. You cannot count on the user having the shim 'six', although it is
becoming increasingly common. Many python installations include it by
default. In any case, as you experienced, it's a simple install.
2. In many places you have something like "m =
ProcManager.TS.search(str(line))". I assume you needed the str() to
convert what would otherwise be a byte-string under Python 3 into a true
string so it can be used in a regular expression. However, by default, that
conversion is done using the ASCII codec. If "line" has something other
than ASCII in it, an exception will be raised. If that's a possibility, you
should use the "decode" function instead: "m =
ProcManager.TS.search(line.decode('utf-8'))".
-tk
On Mon, Mar 25, 2019 at 11:36 AM <[email protected]> wrote:
> Tom,
>
> The driver weewx-tfrc is converted to python 3 and the same file runs
> without problems on both
> pi31 (with python2) as pi36 (with python3). See the attached diff file.
>
> I didn't make any changes on the python2 system.
> I tried to install python-six, but as you can see below, the package was
> already installed.
>
> root@pi31:~# apt-get install python-six
> Reading package lists... Done
> Building dependency tree
> Reading state information... Done
> python-six is already the newest version (1.10.0-3).
> python-six set to manually installed.
> 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
>
> Luc
>