Skip to content

Instantly share code, notes, and snippets.

@brendandburns
Created December 10, 2016 05:09
Show Gist options
  • Select an option

  • Save brendandburns/1da6cdfa00e3b9a2f772d4fe4a8262b8 to your computer and use it in GitHub Desktop.

Select an option

Save brendandburns/1da6cdfa00e3b9a2f772d4fe4a8262b8 to your computer and use it in GitHub Desktop.
path = os.Getenv('PATH')
if platform.system() == 'Windows':
parts = path.split(';')
else:
parts = path.split(':')
for part in parts:
path = os.path.join(part, bin)
if os.path.exists(path) and os.access(path, os.X_OK):
return path
return None
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment