Inserting services into weewx.conf using install.py

63 views
Skip to first unread message

steeple ian

unread,
Nov 24, 2019, 6:52:39 AM11/24/19
to weewx-user
Is it possible to to insert multiple services of the same type using install.py?

Inserting one service into process_services works fine, but when I try to add a second double quotes appear around the result in weewx.conf and subsequently causes WeeWX to exit with an error.

I have tried every permutation of syntax that I can think of without success. Am I not seeing the wood for the trees or is it just not possible?

Thanks
Ian

Thomas Keffer

unread,
Nov 24, 2019, 8:53:15 AM11/24/19
to weewx-user
It would help if you included the error. I don't know what you mean by "...try to add a second double quotes appear around the result..."

--
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/07de6ced-7bfd-47e7-b790-cd23f336fc93%40googlegroups.com.

steeple ian

unread,
Nov 24, 2019, 11:26:08 AM11/24/19
to weewx...@googlegroups.com
Ok, for example

Using this in install.py for a single service: -

process_services='user.program1.Program1Test',

Gave as expected in weewx.conf: -

process_services = user.program1.Program1Test

Adding a second service like so: -

process_services='user.program1.Program1Test, user.program2.Program2.Test',

Gave: - process_services="user.program1.Program1Test, user.program2.Program2.Test"

This: - process_services='user.program1.Program1Test'',''user.program2.Program2.Test',

Gave: - process_services= "user.program1.Program1Test,user.program2.Program2.Test"

Various other combinations either all resulted in similar results with double quote marks or a syntax error when running the install process with wee_extension --install

Thanks,
Ian
    

Thomas Keffer

unread,
Nov 24, 2019, 11:57:35 AM11/24/19
to weewx-user
I should think you'd want

process_service = user.program1.Program1Test, user.program2.Program2.Test

Or, if you want to use quotes,

process_service = 'user.program1.Program1Test', 'user.program2.Program2.Test'

Or, am I missing something?

Incidentally, the two services are using different naming conventions. One says "Program1Test", the other "Program2.Test". Note the period in the second. Don't know if that's a typo, or what you're intending.

-tk

steeple ian

unread,
Nov 24, 2019, 12:12:25 PM11/24/19
to weewx...@googlegroups.com
Thanks Thomas,

Yes that was a typo on my part, I am using the correct convention in the real thing.

Your first example gave the following syntax error

Traceback (most recent call last):
  File "./wee_extension", line 82, in <module>
    main()
  File "./wee_extension", line 74, in main
    ext.install_extension(options.install)
  File "/home/weewx/bin/weecfg/extension.py", line 123, in install_extension
    self.install_from_dir(extension_path)
  File "/home/weewx/bin/weecfg/extension.py", line 138, in install_from_dir
    extension_dir)
  File "/home/weewx/bin/weecfg/__init__.py", line 1599, in get_extension_installer
    __import__('install')
  File "weewx-Weather34/install.py", line 21
    config={
The second example gave this error

Traceback (most recent call last):
  File "./wee_extension", line 82, in <module>
    main()
  File "./wee_extension", line 74, in main
    ext.install_extension(options.install)
  File "/home/weewx/bin/weecfg/extension.py", line 123, in install_extension
    self.install_from_dir(extension_path)
  File "/home/weewx/bin/weecfg/extension.py", line 138, in install_from_dir
    extension_dir)
  File "/home/weewx/bin/weecfg/__init__.py", line 1599, in get_extension_installer
    __import__('install')
  File "weewx-Weather34/install.py", line 19
    process_services='user.program1.Program1Test', 'user.program2.Program2.Test',
SyntaxError: non-keyword arg after keyword arg
Thanks,
Ian


Thomas Keffer

unread,
Nov 24, 2019, 1:23:52 PM11/24/19
to weewx-user
Oh. I misunderstood. I thought we were talking about weewx.conf, not the syntax for install.py. My apologies.

I've never tried installing multiple services in a single engine group, but it probably should be a list. After all, it has to be valid Python. So, try:

process_services = ['user.program1.Program1Test', 'user.program2.Program2Test']

-tk

steeple ian

unread,
Nov 24, 2019, 1:35:34 PM11/24/19
to weewx...@googlegroups.com
No need to apologise, you are a legend for the amount of support you give. And bingo, it worked :-D The strange thing is that I thought that I had tried that permutation although I was going round and round in circles by the end.

Thanks once again,
Ian

Reply all
Reply to author
Forward
0 new messages