Last active
March 4, 2023 17:56
-
-
Save MatthewJDavis/ba97157071ed2bc8cdfaa0432b3448f7 to your computer and use it in GitHub Desktop.
Example on how to call a Python script and save the output of the print statement to a variable.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Calls a Python script. The output of the print statement is saved in a Variable. | |
$pythonProgramPath = ".venv/bin/python" # location of the Python executable | |
$pythonScriptPath = "/python/powershell-call-python/main.py" # location of script file. | |
$arg = "hello" | |
$pythonOutput = & $pythonProgramPath $pythonScriptPath $arg | |
$pythonOutput |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment