WeeWX v4 I Need an Extension Verified/Checked

214 views
Skip to first unread message

G Hammer

unread,
Jan 18, 2020, 9:46:16 PM1/18/20
to weewx-user
I'd like to run v4 when I upgrade hardware this week.
Seems to be doing fine for the devices and skin I use.
With one exception, a RainMachine extension.
There is one that was written by someone at RainMachine, but I think he has moved on.
I've asked there and raised an issue on the github page for the extension with no response.

How, besides installing v4 and the extension, can I determine if it will run under v4?


With this functionality confirmed, I can make the change, without it I'll need to stay with v3


Andrew Milner

unread,
Jan 18, 2020, 11:14:36 PM1/18/20
to weewx-user
I do not think v4 has officially been released yet - so I would recommend installing the new hardware with 3.9 and do the upgrade when v4 is finally released.  That way you do not change the whole shebang - hardware and software - in one giant leap. Regarding 'how do you know' - the answer is that you don't!!  The original writer may update wike or download with additional information, or another user may post a comment, but there is no automatic verification process of all extensions written by other people.

G Hammer

unread,
Jan 18, 2020, 11:39:25 PM1/18/20
to weewx...@googlegroups.com
Seems that there should be a way to determine this as the change to Python 3 isn't just a WeeWX thing.

As for whether or not to run the beta, it's beta 8 and what I use seems to be ok as far as reports go. Is it not what beta are for after all?

Anyway, not what I asked, so let's see what else comes.

--
You received this message because you are subscribed to a topic in the Google Groups "weewx-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/weewx-user/wlufg8AdT0E/unsubscribe.
To unsubscribe from this group and all its topics, send an email to weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/e95133ce-4a77-43db-930f-facf0e73e5e8%40googlegroups.com.

Andrew Milner

unread,
Jan 18, 2020, 11:50:50 PM1/18/20
to weewx-user
why not ask the author of the extension then - if it is important to you to have the answer.  After all, the author is the person who should have the answer.  As to whether the author  has tested against the beta version depends very much upon the time available to the author of the extension I suspect.  I know the bootstrap skin and mesowx took some iterations after the introduction of I think weewx v3 before there were useable versions available - and the changes were actually made by another weewx user rather than the original author.  


On Sunday, 19 January 2020 06:39:25 UTC+2, G Hammer wrote:
Seems that there should be a way to determine this as the change to Python 3 isn't just a WeeWX thing.

As for whether or not to run the beta, it's beta 8 and what I use seems to be ok as far as reports go. Is it not what beta are for after all?

Anyway, not what I asked, so let's see what else comes.

On Sat, Jan 18, 2020, 11:14 PM Andrew Milner <andrew....@gmail.com> wrote:
I do not think v4 has officially been released yet - so I would recommend installing the new hardware with 3.9 and do the upgrade when v4 is finally released.  That way you do not change the whole shebang - hardware and software - in one giant leap. Regarding 'how do you know' - the answer is that you don't!!  The original writer may update wike or download with additional information, or another user may post a comment, but there is no automatic verification process of all extensions written by other people.




On Sunday, 19 January 2020 04:46:16 UTC+2, G Hammer wrote:
I'd like to run v4 when I upgrade hardware this week.
Seems to be doing fine for the devices and skin I use.
With one exception, a RainMachine extension.
There is one that was written by someone at RainMachine, but I think he has moved on.
I've asked there and raised an issue on the github page for the extension with no response.

How, besides installing v4 and the extension, can I determine if it will run under v4?


With this functionality confirmed, I can make the change, without it I'll need to stay with v3


--
You received this message because you are subscribed to a topic in the Google Groups "weewx-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/weewx-user/wlufg8AdT0E/unsubscribe.
To unsubscribe from this group and all its topics, send an email to weewx...@googlegroups.com.

John Kline

unread,
Jan 18, 2020, 11:51:42 PM1/18/20
to weewx...@googlegroups.com
I had a quick look.  It imports Queue (with a capital ‘Q’).  That will fail in python 3.
As such, this has not been ported.

As for an answer to the general question, there are tools available to convert code (2to3, modernize).  It usually requires more work than that, but you could run one of them on the code to see what it changes.  That would give you a good idea of whether it is already python3 ready.

Actually, a better way is just to read up on the subject.  When you do, it will be pretty easy to spot code that will run in 2 and 3.

On Jan 18, 2020, at 8:39 PM, G Hammer <gary....@gmail.com> wrote:


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+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/CALBRR-09JohVQPwKLeyHfVBW6DV1KdZOP5QhLzTm3ms01teygA%40mail.gmail.com.

gjr80

unread,
Jan 19, 2020, 12:04:33 AM1/19/20
to weewx-user
As John said the code has not been ported to WeeWX v4 and definitely will not run under WeeWX v4/python 3. That being said, it may work with WeeWX v4 when run under python 2; looking through the code quickly I don't see anything that obviously will not work under WeeWX v4/python 2. WeeWX v4 logging has changed, with the syslog module no longer being used; however, that will not prevent the extension from running under WeeWX v4/python 2, you will just find the RainMachine log entries will be formatted a little differently.

Its a fairly basic small extension which can be easily and fully ported to WeeWX v4 python 2/3. If you get stuck sing out and we can port it for you.

Gary

On Sunday, 19 January 2020 14:51:42 UTC+10, John Kline wrote:
I had a quick look.  It imports Queue (with a capital ‘Q’).  That will fail in python 3.
As such, this has not been ported.

As for an answer to the general question, there are tools available to convert code (2to3, modernize).  It usually requires more work than that, but you could run one of them on the code to see what it changes.  That would give you a good idea of whether it is already python3 ready.

Actually, a better way is just to read up on the subject.  When you do, it will be pretty easy to spot code that will run in 2 and 3.

On Jan 18, 2020, at 8:39 PM, G Hammer <gary....@gmail.com> wrote:


Seems that there should be a way to determine this as the change to Python 3 isn't just a WeeWX thing.

As for whether or not to run the beta, it's beta 8 and what I use seems to be ok as far as reports go. Is it not what beta are for after all?

Anyway, not what I asked, so let's see what else comes.

On Sat, Jan 18, 2020, 11:14 PM Andrew Milner <andrew....@gmail.com> wrote:
I do not think v4 has officially been released yet - so I would recommend installing the new hardware with 3.9 and do the upgrade when v4 is finally released.  That way you do not change the whole shebang - hardware and software - in one giant leap. Regarding 'how do you know' - the answer is that you don't!!  The original writer may update wike or download with additional information, or another user may post a comment, but there is no automatic verification process of all extensions written by other people.




On Sunday, 19 January 2020 04:46:16 UTC+2, G Hammer wrote:
I'd like to run v4 when I upgrade hardware this week.
Seems to be doing fine for the devices and skin I use.
With one exception, a RainMachine extension.
There is one that was written by someone at RainMachine, but I think he has moved on.
I've asked there and raised an issue on the github page for the extension with no response.

How, besides installing v4 and the extension, can I determine if it will run under v4?


With this functionality confirmed, I can make the change, without it I'll need to stay with v3


--
You received this message because you are subscribed to a topic in the Google Groups "weewx-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/weewx-user/wlufg8AdT0E/unsubscribe.
To unsubscribe from this group and all its topics, send an email to weewx...@googlegroups.com.

--
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.

G Hammer

unread,
Jan 19, 2020, 11:12:16 AM1/19/20
to weewx-user
Thanks for the information, I'll see if I'm able to get it ported.


On Saturday, January 18, 2020 at 11:51:42 PM UTC-5, John Kline wrote:
I had a quick look.  It imports Queue (with a capital ‘Q’).  That will fail in python 3.
As such, this has not been ported.

As for an answer to the general question, there are tools available to convert code (2to3, modernize).  It usually requires more work than that, but you could run one of them on the code to see what it changes.  That would give you a good idea of whether it is already python3 ready.

Actually, a better way is just to read up on the subject.  When you do, it will be pretty easy to spot code that will run in 2 and 3.

On Jan 18, 2020, at 8:39 PM, G Hammer <gary....@gmail.com> wrote:


Seems that there should be a way to determine this as the change to Python 3 isn't just a WeeWX thing.

As for whether or not to run the beta, it's beta 8 and what I use seems to be ok as far as reports go. Is it not what beta are for after all?

Anyway, not what I asked, so let's see what else comes.

On Sat, Jan 18, 2020, 11:14 PM Andrew Milner <andrew....@gmail.com> wrote:
I do not think v4 has officially been released yet - so I would recommend installing the new hardware with 3.9 and do the upgrade when v4 is finally released.  That way you do not change the whole shebang - hardware and software - in one giant leap. Regarding 'how do you know' - the answer is that you don't!!  The original writer may update wike or download with additional information, or another user may post a comment, but there is no automatic verification process of all extensions written by other people.




On Sunday, 19 January 2020 04:46:16 UTC+2, G Hammer wrote:
I'd like to run v4 when I upgrade hardware this week.
Seems to be doing fine for the devices and skin I use.
With one exception, a RainMachine extension.
There is one that was written by someone at RainMachine, but I think he has moved on.
I've asked there and raised an issue on the github page for the extension with no response.

How, besides installing v4 and the extension, can I determine if it will run under v4?


With this functionality confirmed, I can make the change, without it I'll need to stay with v3


--
You received this message because you are subscribed to a topic in the Google Groups "weewx-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/weewx-user/wlufg8AdT0E/unsubscribe.
To unsubscribe from this group and all its topics, send an email to weewx...@googlegroups.com.

--
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.

G Hammer

unread,
Jan 19, 2020, 11:14:00 AM1/19/20
to weewx-user
Thanks for the tips, I'm going to see if I am able to get it working under python 3 as that seems to be the future. Good to know that it may run as is with WeeWX 4.

vince

unread,
Jan 19, 2020, 2:23:19 PM1/19/20
to weewx-user
On Sunday, January 19, 2020 at 8:14:00 AM UTC-8, G Hammer wrote:
Thanks for the tips, I'm going to see if I am able to get it working under python 3 as that seems to be the future. Good to know that it may run as is with WeeWX 4.



Just run it through "2to3 -w" to have it make the most usual changes.  That should get you close.

Be sure if you're using python3 to install the python3 versions of all the modules required for weewx.

G Hammer

unread,
Jan 19, 2020, 5:04:41 PM1/19/20
to weewx-user
When I install the new system Tuesday, I plan to only install python 3.
Hopefully there won't be many changes that need done manually, but I'll see what transpires.

Thanks!

Thomas Keffer

unread,
Jan 19, 2020, 7:52:14 PM1/19/20
to weewx-user
Be sure to read the article Python 3 strategy in the WeeWX Wiki.

-tk

--
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+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/c317f3c6-6472-4591-a8e2-59a40c3f657e%40googlegroups.com.

G Hammer

unread,
Jan 19, 2020, 8:53:55 PM1/19/20
to weewx-user
Excellent info, appreciated!


On Sunday, January 19, 2020 at 7:52:14 PM UTC-5, Thomas Keffer wrote:
Be sure to read the article Python 3 strategy in the WeeWX Wiki.

-tk

On Sun, Jan 19, 2020 at 2:04 PM G Hammer <gary....@gmail.com> wrote:
When I install the new system Tuesday, I plan to only install python 3.
Hopefully there won't be many changes that need done manually, but I'll see what transpires.

Thanks!


On Sunday, January 19, 2020 at 2:23:19 PM UTC-5, vince wrote:
On Sunday, January 19, 2020 at 8:14:00 AM UTC-8, G Hammer wrote:
Thanks for the tips, I'm going to see if I am able to get it working under python 3 as that seems to be the future. Good to know that it may run as is with WeeWX 4.



Just run it through "2to3 -w" to have it make the most usual changes.  That should get you close.

Be sure if you're using python3 to install the python3 versions of all the modules required for weewx.

--
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.

G Hammer

unread,
Feb 21, 2020, 1:35:01 PM2/21/20
to weewx-user
I have installed 4.0.b12 and running only python 3.
I tried 2to3 on the rainmachine extension and while it had no errors in completing, the resulting code is not proper.
When I run weewx directly, it fails when loading rainmachine:
 File "/home/weewx/bin/user/rainmachine.py", line 67
    return None, None
                    ^
TabError: inconsistent use of tabs and spaces in indentation

As I'm not a programmer, I have no idea of what use of tabs and spaces would mean.

Help?

vince

unread,
Feb 21, 2020, 1:44:59 PM2/21/20
to weewx-user
On Friday, February 21, 2020 at 10:35:01 AM UTC-8, G Hammer wrote:
I have installed 4.0.b12 and running only python 3.
I tried 2to3 on the rainmachine extension and while it had no errors in completing, the resulting code is not proper.
When I run weewx directly, it fails when loading rainmachine:
 File "/home/weewx/bin/user/rainmachine.py", line 67
    return None, None
                    ^
TabError: inconsistent use of tabs and spaces in indentation

As I'm not a programmer, I have no idea of what use of tabs and spaces would mean.



Python is particular about indentation of each line, requiring you to basically pick tabs or spaces when you want to indent.

You need to use one way (hint - pick spaces) consistently in a python file.

My 'guess' is your line 67 has a tab in it.  Open it in an editor and backspace so it starts in column 1, then 'space' forward to set the proper indenting.  See if that's all that's needed.  If you used tabs on multiple lines, it'll complain every time until you get all the tabs replaced with spaces throughout.  Be very careful with not messing up the indentation.

If you're using vi or vim as an editor, I'd suggest you add "set expandtab" to your .vimrc file.  If you don't use vi or vim, ignore this sentence :-)


Message has been deleted

G Hammer

unread,
Feb 21, 2020, 3:15:42 PM2/21/20
to weewx-user
Thanks, that got me through the formatting errors. No idea why sometimes in the same line use spaces tab spaces. But all that is cleaned up.
Now, program logic is failing it seems.

raceback (most recent call last):
  File "./bin/weewxd", line 261, in <module>
    main()
  File "./bin/weewxd", line 148, in main
    engine = weewx.engine.StdEngine(config_dict)
  File "/home/weewx/bin/weewx/engine.py", line 75, in __init__
    self.loadServices(config_dict)
  File "/home/weewx/bin/weewx/engine.py", line 136, in loadServices
    obj = weeutil.weeutil.get_object(svc)(self,config_dict)
  File "/home/weewx/bin/weeutil/weeutil.py", line 1093, in get_object
    mod = __import__(module)
  File "/home/weewx/bin/user/rainmachine.py", line 82, in <module>
    class RainMachine(weewx.restx.StdRESTful):
  File "/home/weewx/bin/user/rainmachine.py", line 87, in RainMachine
    site_dict = weewx.restx.get_site_dict(config_dict, 'RainMachine', 'token', 'ip')
NameError: name 'config_dict' is not defined


Runs fine under python 2

Message has been deleted

G Hammer

unread,
Feb 21, 2020, 3:32:41 PM2/21/20
to weewx-user
The code is located at gethub Rainmachine
That page has some additional info that may be helpful as well.



On Friday, February 21, 2020 at 3:28:28 PM UTC-5, J D wrote:
Hi,
You need to post the actual code that produced this error if you want additional help.
Thanks
Message has been deleted

G Hammer

unread,
Feb 21, 2020, 3:47:33 PM2/21/20
to weewx-user
Attached.


On Friday, February 21, 2020 at 3:43:12 PM UTC-5, J D wrote:
Hi,
Need to see the actual file creating the error since you have been changing it based on your previous posts.
Thanks

On Saturday, January 18, 2020 at 7:46:16 PM UTC-7, G Hammer wrote:
rainmachine1.py
Message has been deleted

vince

unread,
Feb 21, 2020, 4:27:13 PM2/21/20
to weewx-user
On Friday, February 21, 2020 at 1:07:39 PM UTC-8, J D wrote:
Hi,
So your edits for the tabs messed up the python indentation. I would go back to a previous version and make sure that for each tab you find that you put in the correct number of spaces so the code still lines up after you replace the tabs as it did before. This is why I need to see the actual file.


I ran the .py file through 2to3 here - see if this helps any.
 
rainmachine.py

G Hammer

unread,
Feb 21, 2020, 4:29:21 PM2/21/20
to weewx-user
I'll take the original and try expand to rid the file of spaces.


On Friday, February 21, 2020 at 4:07:39 PM UTC-5, J D wrote:
Hi,
So your edits for the tabs messed up the python indentation. I would go back to a previous version and make sure that for each tab you find that you put in the correct number of spaces so the code still lines up after you replace the tabs as it did before. This is why I need to see the actual file.
Thanks

On Saturday, January 18, 2020 at 7:46:16 PM UTC-7, G Hammer wrote:

G Hammer

unread,
Feb 21, 2020, 4:31:14 PM2/21/20
to weewx-user
Thanks, I'll give it a try!

G Hammer

unread,
Feb 21, 2020, 4:49:43 PM2/21/20
to weewx-user
No, it did not. I had already ran it through and found many errors.
Going to start from scratch, first removing all tabs in favor of 4 spaces.
Then run it through 2to3, then see what errors out.


On Friday, February 21, 2020 at 4:27:13 PM UTC-5, vince wrote:

G Hammer

unread,
Feb 21, 2020, 4:58:01 PM2/21/20
to weewx-user
Ok, downloaded the file, took the original expand --tabs=4 rainmachine.py > temp.txt replaced the .py file with the .txt file resulting in a rainmachine.py with no tabs.
Ran 2to3 get an error, a lone 'return' on line 67.

RefactoringTool: There was 1 error:
RefactoringTool: Can't parse rainmachine.py: ParseError: bad input: type=1, value='return', context=('    ', (67, 4))



G Hammer

unread,
Feb 21, 2020, 5:00:56 PM2/21/20
to weewx-user
File attached as rainmachine2.py
rainmachine2.py

vince

unread,
Feb 21, 2020, 5:27:21 PM2/21/20
to weewx-user
On Friday, February 21, 2020 at 1:49:43 PM UTC-8, G Hammer wrote:
No, it did not. I had already ran it through and found many errors.
Going to start from scratch, first removing all tabs in favor of 4 spaces.
Then run it through 2to3, then see what errors out.


If you don't share with us what errors you're finding we can't really help.

I'm going to give up on helping with this one.  Best of luck.
 
Message has been deleted

G Hammer

unread,
Feb 21, 2020, 5:31:47 PM2/21/20
to weewx...@googlegroups.com
Well, considering that you didn't address any of the reported errors, I don't see what info would help.


--
You received this message because you are subscribed to a topic in the Google Groups "weewx-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/weewx-user/wlufg8AdT0E/unsubscribe.
To unsubscribe from this group and all its topics, send an email to weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/2fc02509-9f9f-4052-a1cd-91694404f6b2%40googlegroups.com.

vince

unread,
Feb 21, 2020, 5:34:25 PM2/21/20
to weewx-user
On Friday, February 21, 2020 at 2:27:34 PM UTC-8, J D wrote:
Sorry to tell you but what you posted has indentation problems in many places. I would spend some time reading the link I sent you about python indentation and try it again.


The file you are starting with is hosed on the github side.  No way it works as-is with weewx of any version.

There are 39 places on 32 lines.   Simply substituting 4-spaces for 1-tab globally doesn't do it, as it results in hosed space-based indenting that needs hand-fixing to add/delete spaces so the actual code works.

G Hammer

unread,
Feb 21, 2020, 5:36:04 PM2/21/20
to weewx...@googlegroups.com
Perhaps I'll leave this to actual programmers.

If it is something easily done, I'm game.

If it requires hours of hunt the wumpus, seems to be a useless endeavor.

I've removed the tab/space problem. As I do not program, it's beyond me what level of indentation is needed.



On Fri, Feb 21, 2020, 5:27 PM J D <balloon...@gmail.com> wrote:
Hi,
Sorry to tell you but what you posted has indentation problems in many places. I would spend some time reading the link I sent you about python indentation and try it again.
Thanks

On Saturday, January 18, 2020 at 7:46:16 PM UTC-7, G Hammer wrote:
I'd like to run v4 when I upgrade hardware this week.
Seems to be doing fine for the devices and skin I use.
With one exception, a RainMachine extension.
There is one that was written by someone at RainMachine, but I think he has moved on.
I've asked there and raised an issue on the github page for the extension with no response.

How, besides installing v4 and the extension, can I determine if it will run under v4?


With this functionality confirmed, I can make the change, without it I'll need to stay with v3


--
You received this message because you are subscribed to a topic in the Google Groups "weewx-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/weewx-user/wlufg8AdT0E/unsubscribe.
To unsubscribe from this group and all its topics, send an email to weewx-user+...@googlegroups.com.

G Hammer

unread,
Feb 21, 2020, 5:37:45 PM2/21/20
to weewx...@googlegroups.com
Perhaps, but it is working on my production system at the moment under python 2.7

--
You received this message because you are subscribed to a topic in the Google Groups "weewx-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/weewx-user/wlufg8AdT0E/unsubscribe.
To unsubscribe from this group and all its topics, send an email to weewx-user+...@googlegroups.com.
Reply all
Reply to author
Forward
Message has been deleted
0 new messages