I am curious, what is the best way to run python in a virtual environment in a macro?
I don't know about the "best", but the only way I know is
Execute a Shell Script using Python action
What virtual environment?
For an example of some Python in a KM Execute Shell script action :
(if that is what you mean – the reference to a virtual environment is a bit gnomic, and needs unpacking)
The main trick of using things like
virtualenv with Keyboard Maestro shell scripts is that you will have to explicitly export any shell variables that you need – the variables seen by Terminal.app etc are not automatically available to the new shell launched by an Execute Shell Script action
Thanks @ComplexPoint. I am indeed talking about python
virtualenv. I found this interesting article on sourcing a virtual environment from with the python script, so I might give that a try.
That's a good question. I only run my Python scripts from Anaconda virtual environments.
Given that I've just recently started using KM, I haven't tried executing Python scripts from a macro yet. This is going to get interesting.