FileNotFoundErrors from ModResourceLoader now end with .yaml instead of .json

Offen
#106 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Anfängerfreundlichkeit
55/100
Issue-Typ
Bug
Klarheit
Größtenteils klar
Aktivitätsstatus
Ruhig
Tech-Stack
python
Bereich
tooling

Rechercherichtung

Start with src/hexdoc/core/loader.py, especially ModResourceLoader.find_resource, which the traceback shows raising the FileNotFoundError; compare how it determines resource paths and extensions. The example is a missing recipe path ending in .yaml, while the title says these errors should end in .json. Confirm the expected extension behavior and add or run a focused test for the reported case; done means the error path matches the expected extension.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

For example:

│ C:\Users\object\Git\hexdoc\src\hexdoc\minecraft\recipe\recipes.py:74 in load_resource                                       │
│                                                                                                                             │
│    71 │                                                                                                                     │
│    72 │   @classmethod                                                                                                      │
│    73 │   def load_resource(cls, id: ResourceLocation, loader: ModResourceLoader):                                          │
│ ❱  74 │   │   return loader.load_resource(                                                                                  │
│    75 │   │   │   "data",                                                                                                   │
│    76 │   │   │   "recipe" if IsVersion(">=1.21") else "recipes",                                                           │
│    77 │   │   │   id,                                                                                                       │
│                                                                                                                             │
│ C:\Users\object\Git\hexdoc\src\hexdoc\core\loader.py:248 in load_resource                                                   │
│                                                                                                                             │
│   245 │   │   Raises FileNotFoundError if the file does not exist.                                                          │
│   246 │   │   """                                                                                                           │
│   247 │   │                                                                                                                 │
│ ❱ 248 │   │   resource_dir, path = self.find_resource(*args, **kwargs)                                                      │
│   249 │   │   return resource_dir, self._load_path(                                                                         │
│   250 │   │   │   resource_dir,                                                                                             │
│   251 │   │   │   path,                                                                                                     │
│                                                                                                                             │
│ C:\Users\object\Git\hexdoc\src\hexdoc\core\loader.py:307 in find_resource                                                   │
│                                                                                                                             │
│   304 │   │   │   │   if path.is_file():                                                                                    │
│   305 │   │   │   │   │   return resource_dir, path                                                                         │
│   306 │   │                                                                                                                 │
│ ❱ 307 │   │   raise FileNotFoundError(f"Path {path_stub} not found in any resource dir")                                    │
│   308 │                                                                                                                     │
│   309 │   @overload                                                                                                         │
│   310 │   def load_resources(                                                                                               │
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
FileNotFoundError: Path data\hexcasting\recipe\pride_colorizer_pansexual.yaml not found in any resource dir
Vorherrschende Sprache
Python
Sterne
7
Forks
10
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Entwicklungsumgebung

Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus hexdoc-dev/hexdoc

Alle Issues in hexdoc-dev/hexdoc

Ähnliche Issues

Weitere Issues zu Python

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.