grebleem / weewx_wl_import

0 stars 0 forks source link

Wee_import: location depending on chosen type of weewx installation #1

Open hoevenvd opened 4 years ago

hoevenvd commented 4 years ago

There are two methods to install weewx: using the weewx-repository, and using setup.py. Both ways lead to different locations of weewx, config files and utilities. Current method in davis_csv.conf is using the 'setup.py' method. When weewx is installed the repository way, wee_import cannot be found.

As per the weewx manual, location of weewx when setup.py is used

executable: | /home/weewx/bin/weewxd
-- | --
configuration file: | /home/weewx/weewx.conf
skins and templates: | /home/weewx/skins/
sqlite databases: | /home/weewx/archive/
generated web pages and images: | /home/weewx/public_html/
documentation: | /home/weewx/docs/
examples: | /home/weewx/examples/
utilities: | /home/weewx/bin/

And when using the repository way, location is:

executable: | /usr/bin/weewxd
-- | --
configuration file: | /etc/weewx/weewx.conf
skins and templates: | /etc/weewx/skins
sqlite databases: | /var/lib/weewx/
generated web pages and images: | /var/www/html/weewx/
documentation: | /usr/share/doc/weewx/
examples: | /usr/share/doc/weewx/examples/
utilities: | /usr/bin/wee_*

I've used the repository way. Setting WEEWX_ROOT in davis_csv.conf is not enough for me, as bin/weeimport is at another location (/usr/bin/wee) as where the conf file is (/etc/weewx/weewx/conf). When setting WEEWXROOT to /usr (finding the wee utilities), the conf file cannot be found. When setting WEEWX_ROOT to /etc (finding the conf file), the weewx utilities cannot be found. So, when WEEWX_ROOT is set to /usr, wee_import fails:


Traceback (most recent call last):
  File "/usr/share/weewx/wee_import", line 900, in <module>
    main()
  File "/usr/share/weewx/wee_import", line 801, in main
    config_path, config_dict = weecfg.read_config(options.config_path, args)
  File "/usr/share/weewx/weecfg/__init__.py", line 172, in read_config
    config_path = find_file(config_path, args,
  File "/usr/share/weewx/weecfg/__init__.py", line 147, in find_file
    raise IOError("%s is not a file" % file_path)
OSError: /usr/weewx.conf is not a file
grebleem commented 4 years ago

In the next build I will let the program look for the config file in /etc and /home/weewx. I also will add custom config parser. Similar like wee_import --config=CONFIG_FILE