On Friday, May 1, 2020 at 6:36:24 PM UTC-7, Tom Keffer wrote:
>
> echo "hood river\n700,foot\n45\n-125\nmetric\n6\n\n\n" | python ./setup.py
> install
>
> NB: this worked for V3.x. Version 4 asks the user whether s/he wants to
> register the station, so you'd have to add that.
>
>>
>>
Yeah, that's a fail for me here. No matter how many \n are in there, it
barfs right around the altitude prompt. You might want to try it on your
system and see if you have better luck.
Rather than battle that much more, I'm trying to re-add the old --no-prompt
option back in (and hopefully send you a PR) and I'd appreciate some
pointers on my approach. What I was thinking was adding a command-line
option to setup.py again, and simply returning a default set of values if
that option is set.
So in bin/weecfg/__init.py I'd add this to prompt_for_info() at the
top....and something similar in prompt_for_driver() as well.
+ if defaultConfig:
+ default_stn_info = {}
+ default_stn_info['location'] = "My Little Town, Oregon"
+ default_stn_info['altitude'] = [700, 'foot']
+ default_stn_info['latitude'] = 45
+ default_stn_info['longitude'] = -121
+ default_stn_info['register_this_station'] = "false"
+ default_stn_info['units'] = "us"
+ return default_stn_info
+
If I hard define defaultConfig at the top of the file right under your
DEFAULT_URL variable, the code works as expected. If it's set True, it
skips prompts nicely. If not, it prompts. Exactly what I'm looking for.
But it's hard-wired and of course needs to be more flexible.
Question I have is how would I get a setup.py commandline option to this
routine in __init.py__ for weecfg ?
I guess I'm a bit lost in the internals of how all this stuff is put
together under the hood. Pointers appreciated.
--
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/6732c32d-6164-4796-a2e7-eeef2d691d80%40googlegroups.com.