Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get error "You must set MODELDIR environment variable" from CLI call to predictoor/main.py #99

Closed
trentmc opened this issue Aug 28, 2023 · 2 comments · Fixed by #100
Closed
Assignees
Labels
Type: Bug Something isn't working

Comments

@trentmc
Copy link
Member

trentmc commented Aug 28, 2023

To reproduce: do predictoor setup like in its README. Up to doing this CLI call:

python pdr_backend/predictoor/main.py

What this call should have done is give guidance on using approach 1 or 2.

Instead, it raised an error: "You must set MODELDIR environment variable". That's an approach2 specific thing.

Also: the CLI should give better hints about what to do, depending what you give it.

@trentmc trentmc added the Type: Bug Something isn't working label Aug 28, 2023
@trentmc trentmc self-assigned this Aug 28, 2023
trentmc added a commit that referenced this issue Aug 28, 2023
@trizin
Copy link
Contributor

trizin commented Aug 28, 2023

The issue arises when executing python pdr_backend/predictoor/main.py because it imports approach2/main.py. In approach2/main.py, there's a call to getenv_or_exit("MODELDIR") directly within the file scope and not inside a function. Hence, when the file is imported, the environment check is triggered immediately, leading to that error.

074c0e9 looks like a nice fix!

@trentmc
Copy link
Member Author

trentmc commented Aug 28, 2023

Yep, I know.

I've fixed it in this PR, will merge soon.
#100

I also cleaned up the CLI a bit in general

trentmc added a commit that referenced this issue Aug 28, 2023
Fix #99. Including improve CLI itself
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants