Windows/VSCode: pre-commit run is successful but fails when commiting through Vscode
ajbogle3 opened this issue · 1 comments
ajbogle3 commented
Describe the bug
Running pre-commit run
is able to successfully pass, however, making a commit through Vscode produces the following error:
2023-10-31 10:26:10.495 [info] dbt docs generate........................................................Failed
- hook id: dbt-docs-generate
- exit code: 1
Traceback (most recent call last):
File "C:\Users\AdrianBogle\AppData\Local\Programs\Python\Python38\lib\runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\AdrianBogle\AppData\Local\Programs\Python\Python38\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:\Users\AdrianBogle\.cache\pre-commit\reposdk38no5\py_env-python3.8\Scripts\dbt-docs-generate.EXE\__main__.py", line 7, in <module>
File "C:\Users\AdrianBogle\.cache\pre-commit\reposdk38no5\py_env-python3.8\lib\site-packages\dbt_checkpoint\dbt_docs_generate.py", line 37, in main
return run_dbt_cmd(cmd)
File "C:\Users\AdrianBogle\.cache\pre-commit\reposdk38no5\py_env-python3.8\lib\site-packages\dbt_checkpoint\utils.py", line 341, in run_dbt_cmd
output = cmd_output(*list(filter(None, cmd)), expected_code=0)
File "C:\Users\AdrianBogle\.cache\pre-commit\reposdk38no5\py_env-python3.8\lib\site-packages\dbt_checkpoint\utils.py", line 103, in cmd_output
proc = subprocess.Popen(cmd, **kwargs)
File "C:\Users\AdrianBogle\AppData\Local\Programs\Python\Python38\lib\subprocess.py", line 858, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:\Users\AdrianBogle\AppData\Local\Programs\Python\Python38\lib\subprocess.py", line 1311, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified
Executing cmd: `dbt docs generate --no-compile --project-dir src/waterworks/dbt`
.pre-commit-config.yaml:
repos:
- repo: https://github.com/dbt-checkpoint/dbt-checkpoint
rev: v1.1.1
hooks:
- id: dbt-docs-generate
args: ["--cmd-flags", "++no+compile"]
- id: check-script-semicolon
args: ["--manifest", "/tmp/dbt/target/manifest.json"]
.dbt-checkpoint.yaml:
version: 1
disable-tracking: true
dbt-project-dir: src/waterworks/dbt
Expected behavior
I expect Vscode to commit changes to a branch and pass when pre-commit run
is successful.
Version:
dbt-core: 1.4.9
dbt-redshift: 1.4.1
python: 3.8
Additional context
Add any other context about the problem here.
ajbogle3 commented
Fixed: I did not have my python virtual environment in my PATH. Terminal was working no problem, but source control via git through VSCode would fail.