Skip to content

Starting an app from a python script #1918

Answered by mturoci
aranvir asked this question in Q&A
Discussion options

You must be logged in to vote

What already worked in principle was to start the app as a subprocess with subprocess.run(['wave', 'run', 'app']).
However, that only works from within the environment where wave is installed.

The trick is to get the path to your current running python executable via sys.executable or manual path, instead of using the global python.

You may specify the path to the wave executable, something like subprocess.run(['venv', 'bin', 'wave', 'run', 'app']) or run it like python -m uvicorn --host 0.0.0.0 --port 8000 app.py:main (also within subprocess) which shall be the equivalent to wave run.

As always, once you ask for help, you find the solution soon after. Using the cli command like h2o_wa…

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by mturoci
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question Question
2 participants
Converted from issue

This discussion was converted from issue #1915 on April 11, 2023 07:22.