tmo-monitor icon indicating copy to clipboard operation
tmo-monitor copied to clipboard

not seeing .env in 2.0.0beta 4

Open danhausman opened this issue 2 years ago • 7 comments

Running on a raspberry pi, It is not seeing the .env file when I run python3 bin/tmo-monitor.py

I put the .env in the bin folder, then second guessed myself and put in in the tmo-monitor-2.0.0-beta4 folder. No luck either way.

danhausman avatar Feb 04 '22 12:02 danhausman

I had to help someone with this a few days ago. The .env should be in the main project folder, not the bin folder.

Try the following:

  1. pip3 uninstall tmo_monitor
  2. pip3 install .

If that does not work, I think the person finally resolved the issue with pip3 install -e . instead, which is normally used in development mode to detect changes to files in the project.

highvolt-dev avatar Feb 04 '22 13:02 highvolt-dev

ok good, the way I understood it was in the main project. Uninstall and re-install did not work, but using -e did the trick though thanks. May want to put some documentation in the Readme or the .env

Appreciate the quick help.

danhausman avatar Feb 04 '22 13:02 danhausman

@danhausman thanks for confirming. I need to ensure this is setup correctly for seamless upgrades, I probably need to update setup.py for it to behave correctly. Keeping your issue open for now.

highvolt-dev avatar Feb 04 '22 13:02 highvolt-dev

Sounds good, if you need me to test or try anything let me know. I am happy to help.

danhausman avatar Feb 04 '22 14:02 danhausman

I had the same problem on Windows.

pip3 uninstall tmo_monitor
pip3 install -e .

fixed the issue.

Note that the .env file can be in both places, it doesn't matter. The module will go up the directory tree until it finds the first .env file.

AndrewPardoe avatar Feb 05 '22 18:02 AndrewPardoe

This issue should be caused by the fact we are now formally installing the script. The installed copy is not tied back to the cloned repository once installed unless done with the -e flag.

Given that users will not throw a .env file in the location the package is installed, resolving this issue requires some consensus around the most natural behavior that should be used here.

In the future, this package will be uploaded to PyPi (issue #15), in which case users will not have the repository cloned at all.

Some hypothetical search paths:

  • user HOME directory or equivalent (probably would need a namespaced filename or a dot folder)
  • current working directory
  • specified by environment variable e.g. TMO_MONITOR_ENV

Any thoughts here, @danhausman @AndrewPardoe?

highvolt-dev avatar Feb 06 '22 21:02 highvolt-dev

@highvolt-dev This will probably not work for windows but /usr/local/share/etc or /usr/local/share/

danhausman avatar Feb 07 '22 14:02 danhausman