Last active
February 12, 2021 18:06
-
-
Save rvasilevsk/102285a38639fa811f8ddeda7038e4a6 to your computer and use it in GitHub Desktop.
where, which, executable_exists #python.shellutils
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
# [pyperclip/__init__.py at master · asweigart/pyperclip](https://github.com/asweigart/pyperclip/blob/master/src/pyperclip/__init__.py) | |
try: | |
from shutil import which as _executable_exists | |
except ImportError: | |
# The "which" unix command finds where a command is. | |
if platform.system() == 'Windows': | |
WHICH_CMD = 'where' | |
else: | |
WHICH_CMD = 'which' | |
def _executable_exists(name): | |
return subprocess.call([WHICH_CMD, name], | |
stdout=subprocess.PIPE, stderr=subprocess.PIPE) == 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment