The problem with 2to3 is that the results are Python 3 only.

The tool python-modernize
<https://python-modernize.readthedocs.io/en/latest/> does a little better
and its results will run under 2 or 3, but they will also depend on the
library 'six'.

Drivers and uploaders are especially tricky because they have to do string
<--> byte conversions. Those almost always have to be hand coded.

In the end, I've found it easiest just to grind through the code manually.

-tk

On Wed, May 6, 2020 at 4:17 PM Greg from Oz <ubeau...@gmail.com> wrote:

> I have run a program called 2to3 python converter program on some of the
> python2 scripts and it fixed most of the problems and did the conversion to
> the python3 syntax.
>
> example: 2to3 -w /usr/share/weewx/user/owm.py
>
>
> On Wednesday, 6 May 2020 12:31:23 UTC+10, Colin Larsen wrote:
>>
>> Fixed that one with; sudo python3 -m pip install paho-mqtt
>>
>> Now I have an error that looks like it is Open Wetaher map?
>>
>> May  6 14:29:07 raspberrypi weewx[6896] CRITICAL __main__: Caught
>> unrecoverable exception:
>>
>> May  6 14:29:07 raspberrypi weewx[6896] CRITICAL __main__:     ****  invalid
>> syntax (owm.py, line 84)
>>
>> May  6 14:29:07 raspberrypi weewx[6896] CRITICAL __main__:     ****  
>> Traceback
>> (most recent call last):
>>
>> May  6 14:29:07 raspberrypi weewx[6896] CRITICAL __main__:     ****    File
>> "/usr/share/weewx/weewxd", line 148, in main
>>
>> May  6 14:29:07 raspberrypi weewx[6896] CRITICAL __main__:     ****      
>> engine
>> = weewx.engine.StdEngine(config_dict)
>>
>> May  6 14:29:07 raspberrypi weewx[6896] CRITICAL __main__:     ****    File
>> "/usr/share/weewx/weewx/engine.py", line 75, in __init__
>>
>> May  6 14:29:07 raspberrypi weewx[6896] CRITICAL __main__:     ****
>> self.loadServices(config_dict)
>>
>> May  6 14:29:07 raspberrypi weewx[6896] CRITICAL __main__:     ****    File
>> "/usr/share/weewx/weewx/engine.py", line 138, in loadServices
>>
>> May  6 14:29:07 raspberrypi weewx[6896] CRITICAL __main__:     ****      obj
>> = weeutil.weeutil.get_object(svc)(self,config_dict)
>>
>> May  6 14:29:07 raspberrypi weewx[6896] CRITICAL __main__:     ****    File
>> "/usr/share/weewx/weeutil/weeutil.py", line 1093, in get_object
>>
>> May  6 14:29:07 raspberrypi weewx[6896] CRITICAL __main__:     ****      mod
>> = __import__(module)
>>
>> May  6 14:29:07 raspberrypi weewx[6896] CRITICAL __main__:     ****    File
>> "/usr/share/weewx/user/owm.py", line 84
>>
>> May  6 14:29:07 raspberrypi weewx[6896] CRITICAL __main__:     ****      
>> except
>> KeyError, e:
>>
>> May  6 14:29:07 raspberrypi weewx[6896] CRITICAL __main__:     ****
>>                 ^
>>
>> May  6 14:29:07 raspberrypi weewx[6896] CRITICAL __main__:     ****  
>> SyntaxError:
>> invalid syntax
>>
>> May  6 14:29:07 raspberrypi weewx[6896] CRITICAL __main__:     ****
>> Exiting.
>>
>> On Wed, 6 May 2020 at 14:19, Colin Larsen <colin...@gmail.com> wrote:
>>
>>> Still going ......
>>>
>>> Installed the new mqtt and now get this error
>>>
>>> May  6 14:16:47 raspberrypi weewx[6432] CRITICAL __main__: Caught
>>> unrecoverable exception:
>>>
>>> May  6 14:16:47 raspberrypi weewx[6432] CRITICAL __main__:     ****  No
>>> module named 'paho'
>>>
>>> May  6 14:16:47 raspberrypi weewx[6432] CRITICAL __main__:     ****  
>>> Traceback
>>> (most recent call last):
>>>
>>> May  6 14:16:47 raspberrypi weewx[6432] CRITICAL __main__:     ****    File
>>> "/usr/share/weewx/weewxd", line 148, in main
>>>
>>> May  6 14:16:47 raspberrypi weewx[6432] CRITICAL __main__:     ****
>>>   engine = weewx.engine.StdEngine(config_dict)
>>>
>>> May  6 14:16:47 raspberrypi weewx[6432] CRITICAL __main__:     ****    File
>>> "/usr/share/weewx/weewx/engine.py", line 75, in __init__
>>>
>>> May  6 14:16:47 raspberrypi weewx[6432] CRITICAL __main__:     ****
>>>   self.loadServices(config_dict)
>>>
>>> May  6 14:16:47 raspberrypi weewx[6432] CRITICAL __main__:     ****    File
>>> "/usr/share/weewx/weewx/engine.py", line 138, in loadServices
>>>
>>> May  6 14:16:47 raspberrypi weewx[6432] CRITICAL __main__:     ****
>>>   obj = weeutil.weeutil.get_object(svc)(self,config_dict)
>>>
>>> May  6 14:16:47 raspberrypi weewx[6432] CRITICAL __main__:     ****    File
>>> "/usr/share/weewx/weeutil/weeutil.py", line 1093, in get_object
>>>
>>> May  6 14:16:47 raspberrypi weewx[6432] CRITICAL __main__:     ****
>>>   mod = __import__(module)
>>>
>>> May  6 14:16:47 raspberrypi weewx[6432] CRITICAL __main__:     ****    File
>>> "/usr/share/weewx/user/mqtt.py", line 94, in <module>
>>>
>>> May  6 14:16:47 raspberrypi weewx[6432] CRITICAL __main__:     ****
>>>   import paho.mqtt.client as mqtt
>>>
>>> May  6 14:16:47 raspberrypi weewx[6432] CRITICAL __main__:     ****  
>>> ImportError:
>>> No module named 'paho'
>>>
>>> May  6 14:16:47 raspberrypi weewx[6432] CRITICAL __main__:     ****
>>> Exiting.
>>>
>>>
>>> Tried to install Paho and I get  ...
>>>
>>>
>>> *pi@raspberrypi*:*/etc/default $* sudo pip install paho-mqtt
>>>
>>> Requirement already satisfied: paho-mqtt in
>>> /usr/local/lib/python2.7/dist-packages
>>>
>>>
>>> So how do I install it for python3 please :)
>>>
>>>
>>>
>>> Cheers
>>>
>>> Colin
>>>
>>> On Tue, 5 May 2020 at 00:18, Graham Eddy <graha...@gmail.com> wrote:
>>>
>>>> this (ujson instead of python-cjson, then install mqtt extension) seems
>>>> to have worked up to point that weewx.log reports its mqtt client is
>>>> successfully publishing loop data
>>>>
>>>> sudo python3.7 -m pip install ujson
>>>>
>>>>
>>>> On 4 May 2020, at 8:58 pm, Graham Eddy <graha...@gmail.com> wrote:
>>>>
>>>> i have only just become interested in mqtt (to make my custom weewx
>>>> gauges near realtime).
>>>> the link to the MQTT weewx extension mentioned below lists two
>>>> prerequisites: paho-mqtt, python-cjson.
>>>> paho-mqtt installed fine.
>>>> python-cjson fails.
>>>>
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "weewx-user" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to weewx...@googlegroups.com.
>>>> To view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/weewx-user/296D8321-100E-45B1-A47A-2657960A2942%40gmail.com
>>>> <https://groups.google.com/d/msgid/weewx-user/296D8321-100E-45B1-A47A-2657960A2942%40gmail.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>> --
> You received this message because you are subscribed to the Google Groups
> "weewx-user" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to weewx-user+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/weewx-user/5edba9a8-8cbb-4ae9-8b86-68b0c5a9cdf7%40googlegroups.com
> <https://groups.google.com/d/msgid/weewx-user/5edba9a8-8cbb-4ae9-8b86-68b0c5a9cdf7%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/CAPq0zEAsFLE65CfXeW17GeyzFepN-%2B0uZhkOyvAE6NCsseVs0g%40mail.gmail.com.

Reply via email to