Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TemplateNotFound: paprika.jinja2.json #29

Closed
patryk-31 opened this issue Nov 5, 2023 · 3 comments
Closed

TemplateNotFound: paprika.jinja2.json #29

patryk-31 opened this issue Nov 5, 2023 · 3 comments

Comments

@patryk-31
Copy link

Hi,

trying to export to paprika I'm getting a TemplateNotFound error.
I am using kptncook version 0.0.14 and got the same error on windows and linux (the log if from windows).
Is this a bug or am I doing something wrong?
Thank you.

Console Output:

> kptncook export-recipes-to-paprika
...
│ │                 │   │   │   │   │   de='Salz',                                               │ │
│ │                 │   │   │   │   │   es='sal',                                                │ │
│ │                 │   │   │   │   │   fr='sel',                                                │ │
│ │                 │   │   │   │   │   pt='sal'                                                 │ │
│ │                 │   │   │   │   ),                                                           │ │
│ │                 │   │   │   │   category='SpicesSeasoning'                                   │ │
│ │                 │   │   │   )                                                                │ │
│ │                 │   │   ),                                                                   │ │
│ │                 │   │   ... +2                                                               │ │
│ │                 │   ]                                                                        │ │
│ │                 )                                                                            │ │
│ │          self = <kptncook.paprika.ExportRenderer object at 0x000001708A22C470>               │ │
│ │ template_name = 'paprika.jinja2.json'                                                        │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
│                                                                                                  │
│ C:\Users\patry\.local\pipx\venvs\kptncook\Lib\site-packages\jinja2\environment.py:1010 in        │
│ get_template                                                                                     │
│                                                                                                  │
│   1007 │   │   if parent is not None:                                                            │
│   1008 │   │   │   name = self.join_path(name, parent)                                           │
│   1009 │   │                                                                                     │
│ ❱ 1010 │   │   return self._load_template(name, globals)                                         │
│   1011 │                                                                                         │
│   1012 │   @internalcode                                                                         │
│   1013 │   def select_template(                                                                  │
│                                                                                                  │
│ ╭──────────────────────────────── locals ─────────────────────────────────╮                      │
│ │ globals = None                                                          │                      │
│ │    name = 'paprika.jinja2.json'                                         │                      │
│ │  parent = None                                                          │                      │
│ │    self = <jinja2.environment.Environment object at 0x000001708A0660F0> │                      │
│ ╰─────────────────────────────────────────────────────────────────────────╯                      │
│                                                                                                  │
│ C:\Users\patry\.local\pipx\venvs\kptncook\Lib\site-packages\jinja2\environment.py:969 in         │
│ _load_template                                                                                   │
│                                                                                                  │
│    966 │   │   │   │                                                                             │
│    967 │   │   │   │   return template                                                           │
│    968 │   │                                                                                     │
│ ❱  969 │   │   template = self.loader.load(self, name, self.make_globals(globals))               │
│    970 │   │                                                                                     │
│    971 │   │   if self.cache is not None:                                                        │
│    972 │   │   │   self.cache[cache_key] = template                                              │
│                                                                                                  │
│ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │
│ │ cache_key = (                                                                                │ │
│ │             │   <weakref at 0x000001708A233560; to 'FileSystemLoader' at                     │ │
│ │             0x0000017087ACE4E0>,                                                             │ │
│ │             │   'paprika.jinja2.json'                                                        │ │
│ │             )                                                                                │ │
│ │   globals = None                                                                             │ │
│ │      name = 'paprika.jinja2.json'                                                            │ │
│ │      self = <jinja2.environment.Environment object at 0x000001708A0660F0>                    │ │
│ │  template = None                                                                             │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
│                                                                                                  │
│ C:\Users\patry\.local\pipx\venvs\kptncook\Lib\site-packages\jinja2\loaders.py:126 in load        │
│                                                                                                  │
│   123 │   │                                                                                      │
│   124 │   │   # first we try to get the source for this template together                        │
│   125 │   │   # with the filename and the uptodate function.                                     │
│ ❱ 126 │   │   source, filename, uptodate = self.get_source(environment, name)                    │
│   127 │   │                                                                                      │
│   128 │   │   # try to load the code from the bytecode cache if there is a                       │
│   129 │   │   # bytecode cache configured.                                                       │
│                                                                                                  │
│ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │
│ │        code = None                                                                           │ │
│ │ environment = <jinja2.environment.Environment object at 0x000001708A0660F0>                  │ │
│ │     globals = ChainMap({}, {'range': <class 'range'>, 'dict': <class 'dict'>, 'lipsum':      │ │
│ │               <function generate_lorem_ipsum at 0x000001708A01A0C0>, 'cycler': <class        │ │
│ │               'jinja2.utils.Cycler'>, 'joiner': <class 'jinja2.utils.Joiner'>, 'namespace':  │ │
│ │               <class 'jinja2.utils.Namespace'>})                                             │ │
│ │        name = 'paprika.jinja2.json'                                                          │ │
│ │        self = <jinja2.loaders.FileSystemLoader object at 0x0000017087ACE4E0>                 │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
│                                                                                                  │
│ C:\Users\patry\.local\pipx\venvs\kptncook\Lib\site-packages\jinja2\loaders.py:218 in get_source  │
│                                                                                                  │
│   215 │   │   │                                                                                  │
│   216 │   │   │   # Use normpath to convert Windows altsep to sep.                               │
│   217 │   │   │   return contents, os.path.normpath(filename), uptodate                          │
│ ❱ 218 │   │   raise TemplateNotFound(template)                                                   │
│   219 │                                                                                          │
│   220 │   def list_templates(self) -> t.List[str]:                                               │
│   221 │   │   found = set()                                                                      │
│                                                                                                  │
│ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │
│ │ environment = <jinja2.environment.Environment object at 0x000001708A0660F0>                  │ │
│ │           f = None                                                                           │ │
│ │    filename = 'C:\\Users\\patry\\.local\\pipx\\venvs\\kptncook\\Lib\\site-packages\\templat… │ │
│ │      pieces = ['paprika.jinja2.json']                                                        │ │
│ │  searchpath = 'C:\\Users\\patry\\.local\\pipx\\venvs\\kptncook\\Lib\\site-packages\\templat… │ │
│ │        self = <jinja2.loaders.FileSystemLoader object at 0x0000017087ACE4E0>                 │ │
│ │    template = 'paprika.jinja2.json'                                                          │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
TemplateNotFound: paprika.jinja2.json
@ephes
Copy link
Owner

ephes commented Nov 5, 2023

It's a but, I can reproduce your error. Funny enough, when I run ktpncook in the editable installed version I use mose often, it works. It's only when I use the version installed via pipx I get the same traceback. Duh.

ephes added a commit that referenced this issue Nov 6, 2023
…prika export as string into paprika module
ephes added a commit that referenced this issue Nov 6, 2023
@ephes
Copy link
Owner

ephes commented Nov 6, 2023

Ok, the template was missing in the package 😅. I now moved it into the paprika.py module which should fix this. New release 0.0.15 is available now.

@ephes ephes closed this as completed Nov 6, 2023
@patryk-31
Copy link
Author

0.0.15 fixed it for me as well.
Thank you! ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants