Skip to content

Commit

Permalink
Improve executable finding
Browse files Browse the repository at this point in the history
  • Loading branch information
spyoungtech committed Aug 21, 2021
1 parent 57cd15f commit 36b7314
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions ahk/script.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,11 @@ class ExecutableNotFoundError(EnvironmentError):

def _resolve_executable_path(executable_path: str = ''):
if not executable_path:
executable_path = os.environ.get('AHK_PATH') or which(
'AutoHotkey.exe') or which('AutoHotkeyA32.exe')
executable_path = os.environ.get('AHK_PATH') \
or which('AutoHotkey.exe') \
or which('AutoHotkeyU64.exe') \
or which('AutoHotkeyU32.exe') \
or which('AutoHotkeyA32.exe')

if not executable_path:
if os.path.exists(DEFAULT_EXECUTABLE_PATH):
Expand All @@ -43,7 +46,8 @@ def _resolve_executable_path(executable_path: str = ''):
raise ExecutableNotFoundError(
'Could not find AutoHotkey.exe on PATH. '
'Provide the absolute path with the `executable_path` keyword argument '
'or in the AHK_PATH environment variable.'
'or in the AHK_PATH environment variable. '
'You may be able to resolve this error by installing the binary extra: pip install "ahk[binary]"'
)

if not os.path.exists(executable_path):
Expand Down

0 comments on commit 36b7314

Please sign in to comment.