by Guest » 18 Jan 2025, 22:22
Ich verwende Pre-Commit. In einem der Hooks verwende ich ein Python-Skript, das die Yaml-Bibliothek importiert.
Wenn ich jedoch versuche, etwas zu committen, erhalte ich bei diesem Hook die folgende Fehlermeldung:
Code: Select all
ModuleNotFoundError: No module named 'yaml'
Ich verstehe nicht, wo das Problem liegt, da pyyaml ordnungsgemäß in Python gefunden wird
Code: Select all
$ python3
Python 3.12.3 (main, Nov 6 2024, 18:32:19) [GCC 13.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import yaml
>>>
Hier ist meine .pre-commit-config.yml:
Code: Select all
repos:
# python hooks
- repo: local
hooks:
- id: yaml-arrays-sort
name: YAML Arrays Sort
description: Sort arrays in YAML files
entry: python scripts/yaml-arrays-sort.py
pass_filenames: false
language: python
Ich verwende Pre-Commit. In einem der Hooks verwende ich ein Python-Skript, das die Yaml-Bibliothek importiert.
Wenn ich jedoch versuche, etwas zu committen, erhalte ich bei diesem Hook die folgende Fehlermeldung:
[code]ModuleNotFoundError: No module named 'yaml'
[/code]
Ich verstehe nicht, wo das Problem liegt, da pyyaml ordnungsgemäß in Python gefunden wird
[code]$ python3
Python 3.12.3 (main, Nov 6 2024, 18:32:19) [GCC 13.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import yaml
>>>
[/code]
Hier ist meine .pre-commit-config.yml:
[code]repos:
# python hooks
- repo: local
hooks:
- id: yaml-arrays-sort
name: YAML Arrays Sort
description: Sort arrays in YAML files
entry: python scripts/yaml-arrays-sort.py
pass_filenames: false
language: python
[/code]