github / github/codeql

Not compatible with pyenv-win or other Python environments without PY.EXE

Đang mở
#4,303 3 bình luận 0 reaction 0 người được giao Xem trên GitHub
Python
Ngôn ngữ chính
CodeQL
Star
10.1k
Fork
2.1k
Merge trung bình
2 ngày 15 giờ
Pull request đã merge (30 ngày)
141

Mô tả

When I setup a new database with Python language on Windows, an exception was raised:

```
λ codeql database create talkbook --language=python --source-root=d:/pro/talkbook
Initializing database at d:\pro\codeql-repo\talkbook.
Running command [D:\program\codeql\python\tools\autobuild.cmd] in d:\pro\talkbook.
[2020-08-21 02:27:51] [build] Calling py -3 D:\program\codeql\python\tools\get_venv_lib.py
[2020-08-21 02:27:51] [build] Error trying to run get_venv_lib (this is Python 3.7.2)
[2020-08-21 02:27:51] [build] Traceback (most recent call last):
[2020-08-21 02:27:51] [build] File line 62, in lib
[2020-08-21 02:27:51] [build] self._lib = subprocess.check_output(args)
[2020-08-21 02:27:51] [build] File "C:\Users\phith0n\.pyenv\pyenv-win\versions\3.7.2\lib\subprocess.py", line 395, in check_output
[2020-08-21 02:27:51] [build] **kwargs).stdout
[2020-08-21 02:27:51] [build] File "C:\Users\phith0n\.pyenv\pyenv-win\versions\3.7.2\lib\subprocess.py", line 472, in run
[2020-08-21 02:27:51] [build] with Popen(*popenargs, **kwargs) as process:
[2020-08-21 02:27:51] [build] File "C:\Users\phith0n\.pyenv\pyenv-win\versions\3.7.2\lib\subprocess.py", line 775, in __init__
[2020-08-21 02:27:51] [build] restore_signals, start_new_session)
[2020-08-21 02:27:51] [build] File "C:\Users\phith0n\.pyenv\pyenv-win\versions\3.7.2\lib\subprocess.py", line 1178, in _execute_child
[2020-08-21 02:27:51] [build] startupinfo)
[2020-08-21 02:27:51] [build] FileNotFoundError: [WinError 2] The system cannot find the file specified
[2020-08-21 02:27:51] [build] Calling py -3 -S D:\program\codeql\python\tools\python_tracer.py -v -z all -c d:\pro\codeql-repo\talkbook\working\trap_cache -p d:\pro\codeql-repo\talkbook\working\venv\Lib -R d:\pro\talkbook
[2020-08-21 02:27:51] [build-err] Traceback (most recent call last):
[2020-08-21 02:27:51] [build-err] File "D:\program\codeql\python\tools\index.py", line 19, in
[2020-08-21 02:27:51] [build-err] buildtools.index.main()
[2020-08-21 02:27:51] [build-err] File "D:\program\codeql\python\tools\python3src.zip\buildtools\index.py", line 110, in main
[2020-08-21 02:27:51] [build-err] File "C:\Users\phith0n\.pyenv\pyenv-win\versions\3.7.2\lib\subprocess.py", line 342, in check_call
[2020-08-21 02:27:51] [build-err] retcode = call(*popenargs, **kwargs)
[2020-08-21 02:27:51] [build-err] File "C:\Users\phith0n\.pyenv\pyenv-win\versions\3.7.2\lib\subprocess.py", line 323, in call
[2020-08-21 02:27:51] [build-err] with Popen(*popenargs, **kwargs) as p:
[2020-08-21 02:27:51] [build-err] File "C:\Users\phith0n\.pyenv\pyenv-win\versions\3.7.2\lib\subprocess.py", line 775, in __init__
[2020-08-21 02:27:51] [build-err] restore_signals, start_new_session)
[2020-08-21 02:27:51] [build-err] File "C:\Users\phith0n\.pyenv\pyenv-win\versions\3.7.2\lib\subprocess.py", line 1178, in _execute_child
[2020-08-21 02:27:51] [build-err] startupinfo)
[2020-08-21 02:27:51] [build-err] FileNotFoundError: [WinError 2] The system cannot find the file specified
[2020-08-21 02:27:51] [ERROR] Spawned process exited abnormally (code 1; tried to run: [D:\program\codeql\tools\win64\runner.exe, cmd.exe, /C, type, NUL, &&, D:\program\codeql\python\tools\autobuild.cmd])
A fatal error occurred: Exit status 1 from command: [D:\program\codeql\tools\win64\runner.exe, cmd.exe, /C, type, NUL, &&, D:\program\codeql\python\tools\autobuild.cmd]
```

After review about the reason of this mess, I found that I don't have the `py.exe` executable program, which is used by `python\tools\python3src.zip\buildtools\version.py`:

```python
WIN = (sys.platform == 'win32')

def executable(version):
if WIN:
return ['py', ('-%s' % version)]
else:
return [('python%s' % version)]
```

I install the Python with [pyenv-win](https://github.com/pyenv-win/pyenv-win), which is a Python version management. Pyenv-win will not install the `py.exe` for users, maybe it was the cause of the exception.

Otherwise, **py.exe** is not a necessary thing for Python environment. So I believe there is a much better way to choice a right executable program rather than depending on **py.exe**.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.