Thank you both for your swift replies!

Here's where my mistake was rooted: I assumed weewx 4.0 only supported 
Python3, and missed the point that it was written to support both Python2 
and Python3 simultaneously. Therefore, I just followed the instructions in 
'upgrading.htm' - and assumed that the upgrade steps would upgrade my weewx 
to one supporting Python3. 

But, since weewx supports both, just executing "./setup.py ..." as 
mentioned in 'upgrading.htm' chooses the python based on the "env python" 
in the first line of the setup.py script, it meant that a Python2 based 
upgrade happened, creating binaries that referenced "/usr/bin/python" vs 
"/usr/bin/python3". 

Since the errors reported upon weewx startup (and later, report generation) 
were so trivial to resolve in a couple of minutes (by just pulling in 
Cheetah3, PyMysql and Pillow with pip3), I never dug more deeply into the 
documentation to see what was wrong. It was so easy to resolve.

Most of my time was spent scanning through the weewx-purpleair extension. 
Since it had been written to support only Python2, I didn't want to make 
just the syntactic changes, but convince myself that the rest of the script 
would actually do what was intended. It's a short script - but the reason I 
am taking a while to send the changes upstream is that I want to see if the 
divisions (/)  in the script should be changed to floor divisions (//) to 
mimic Python2's behavior - and I want to make sure the results look 
reasonable over a period of time before suggesting them upstream.

Yes, if I were installing weewx from scratch, the few minutes spent at the 
start would not have been needed, as the setup.htm documentation does 
indeed mention python3 compatible packages. :)

Overall, it was a very easy experience, with weewx working flawlessly, with 
the only possible suggestion from me being this: that there be some sort of 
text in upgrading.htm about upgrading weewx from python2 to python3.

-Joel

On Monday, February 17, 2020 at 6:12:51 AM UTC-8, John Kline wrote:
>
> Assuming you used setup.py to install, a lot of this is covered in the 
> documentation.  For example, you’ll find the python3 packages you need to 
> install.  You’ll also see the steps to install are:
>
> python3 ./setup.py build
> sudo python3 ./setup.py install
>
> With the above steps, you won’t need to hand edit the scripts to use 
> python3.
>
> To view the WeeWX 4 setup guide in HTML, click the link below:
>
>
> https://htmlpreview.github.io/?https://raw.githubusercontent.com/weewx/weewx/master/docs/setup.htm
>
>
> On Feb 17, 2020, at 6:02 AM, Joel Bion <[email protected] <javascript:>> 
> wrote:
>
> 
> My system still has Python2 installed. I also have Python-3.8.1. Here's 
> what I had to do to get weewx 4.0.0b12 working on my system, which supports 
> both python2 and python3 simultaneously:
>
>    1. Since "python" on my system resolves to Python2 - I had to change 
>    the executable scripts in /home/weewx/bin to have hashbangs that 
> referenced 
>    /usr/bin/python3
>    2. I had to install PyMySQL for Python3. MySQLdb/MySQL-Python just 
>    didn't work for me. PyMySQL worked like a charm.
>    3. I had to install Cheetah3.
>    4. I had to install Pillow for images support. The very old "imaging" 
>    package (I think v1.1.7?) didn't work for me with Python3.
>    5. As to other Python packages needed for weewx under Python3, I 
>    haven't checked. I had a good number installed already. The above 
>    (Cheetah3, PyMySQL, Pillow) were the ones I had to install because I did 
>    not already have them under Python3. 
>    6. I wondered how old the stuff was in the bin/user directory - and 
>    there were a couple of extensions I no longer used, which I just removed, 
>    and then I upgraded my versions of __init__.py and extensions.py from the 
>    4.0.0b12 source tree. To get the 'purpleair' extension working in Python3, 
>    I had to make a couple of syntax edits (print is a function, not a 
>    statement) and (exception handling uses the 'as' keyword). When I see the 
>    'purpleair' extension working for a week or so, I will send these trivial 
>    edits up-stream.
>    
> The above got me running on a system supporting both Python2 and Python3. 
> Total work was probably about 60-90 minutes; not bad! It was nice to see 
> how relatively easy it was upgrading to WeeWx 4.0, and all of the changes I 
> had to make had nothing to do with the Weewx code. 
>
> I'm scanning through the weewx doc to see if it references the newer 
> Python3 modules, but with the work-week beginning, that may not happen 
> right away.
>
> At some point, when GCC 10.0 comes out, it will be time to rebuild my 
> system from the ground up. (I use linuxfromscratch, which is sort of a 
> 'build-it-yourself step-by-step distribution.) When I do that, I am going 
> to try to have a python3-only system under which to try to run Weewx.
>
> -Joel
>
> -- 
> 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] <javascript:>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/weewx-development/dd3aefaa-b407-4d35-808d-542acdeb3d80%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/weewx-development/dd3aefaa-b407-4d35-808d-542acdeb3d80%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/910cd84f-c1a6-4127-bb67-e623d6f486d0%40googlegroups.com.

Reply via email to