New submission from Alexander Todorov <atodo...@otb.bg>:
As part of installing python-bugzilla via pip it searches for `rst2man` or `rst2man.py`, see: https://github.com/python-bugzilla/python-bugzilla/blob/master/setup.py#L81 on Windows venvs there is venv\Scripts\rst2man.py (no .exe or without suffix) and when you call find_executable('rst2man.py') if doesn't find it. The trouble is in this code snippet: ``` _, ext = os.path.splitext(executable) if (sys.platform == 'win32') and (ext != '.exe'): executable = executable + '.exe' ``` `ext` here is `.py` and the if condition executes its body so the executable to search for becomes `rst2man.py.exe` which doesn't exist. The extension check has been like that for more than 20 years: https://github.com/python/cpython/commit/69628b0ad10f89a65902f5b911d1040ed9ae1ca2 but IMO it should be ``` if (sys.platform == 'win32') and (ext == ''): executable = executable + '.exe' ``` i.e. add `.exe` only if the file we're looking for doesn't already have an extension. Let me know what you think? I can submit a PR for this. Related issues: - https://bugs.python.org/issue2200 - https://bugs.python.org/issue39260 ---------- components: Distutils messages: 378150 nosy: Alexander.Todorov, dstufft, eric.araujo priority: normal severity: normal status: open title: distutils.spawn.find_executable() fails to find .py files on Windows type: behavior _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue41965> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com