ahk icon indicating copy to clipboard operation
ahk copied to clipboard

Cannot find AHKv2 if only AHKv1 is in path

Open michaelmesser opened this issue 8 months ago • 1 comments

describe your issue

I had an end user who I believe had AHKv1 in their path, but did not have v2 in their path. This lead to an error "AutoHotkey v2 was request but AutoHotkey v1 was detected for executable C:\Program Files\AutoHotkey\Autohotkey.exe"

Explicitly specifying the executable path with r'C:\Program Files\AutoHotkey\v2\AutoHotkey64.exe' worked. I think this is the relevant line of code is: https://github.com/spyoungtech/ahk/blob/1bfb9924b7e4453dab1eaf59141367246089b5d1/ahk/_utils.py#L97

ahk.version

1.7.8

AutoHotkey version

v2

Code to reproduce the issue

from ahk import AHK
ahk = AHK(
    version='v2'
)

Traceback/Error message

No response

michaelmesser avatar Apr 08 '25 20:04 michaelmesser

Thanks for the report. There's probably some improvements that can be made in the _resolve_executable_path function to help address this issue.

spyoungtech avatar Apr 09 '25 19:04 spyoungtech