What is the best method for identifying an executable within Python?
I found that the following function will find the notepad executable
from shutil import which
which('notepad')
Out[32]: 'C:\\Windows\\system32\\notepad.EXE'
another way to do it.
from distutils import spawn
spawn.find_executable('notepad')
Out[38]: 'C:\\Windows\\system32\\notepad.exe'
While both methods work for notepad, I can't seem to get them to find other executables like vlc.exe, gimp-2.10.exe, or others. What is a better method for finding executable files on a computer?
PATH
. Perhaps edit to clarify the scope? – Bingoimport sys; sys.executable
but not sure if it's a good match for your exact requirement. – Ingravescent