79339366

Date: 2025-01-08 13:40:55
Score: 2
Natty:
Report link

Since Python is an interpreted language, each enviroment links to an executable associated with the enviroment, which then interprets the Python code. Have you thought about using subprocess.run () to therefore start the matching executable with the code you want to run as a file parameter?

import subprocess

python_executable = f"{path_to_enviroment}/bin/python" 
command = [python_executable, script_path]

result = subprocess.run(command, capture_output=True, text=True)
Reasons:
  • Has code block (-0.5):
  • Ends in question mark (2):
  • Low reputation (0.5):
Posted by: theotechnic