<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Jinja on Living Systems_</title>
    <link>https://livesys.se/tags/jinja/</link>
    <description>Recent content in Jinja on Living Systems_</description>
    <generator>Hugo</generator>
    <language>en-us</language>
    <lastBuildDate>Mon, 04 Mar 2024 14:42:00 +0100</lastBuildDate>
    <atom:link href="https://livesys.se/tags/jinja/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Debugging inside Jinja templates using pdb/ipdb</title>
      <link>https://livesys.se/posts/debugging-inside-jinja-templates-using-pdb-ipdb/</link>
      <pubDate>Mon, 04 Mar 2024 14:42:00 +0100</pubDate>
      <guid>https://livesys.se/posts/debugging-inside-jinja-templates-using-pdb-ipdb/</guid>
      <description>&lt;p&gt;I&amp;rsquo;m working on a static reporting tool using the Jinja2 templating&#xA;engine for Python.&lt;/p&gt;&#xA;&lt;p&gt;I was trying to figure out a way to enter into the Jinja templating code&#xA;with the pdb/ipdb commandline debugger.&lt;/p&gt;&#xA;&lt;p&gt;I tried creating an &lt;code&gt;.ipdbrc&lt;/code&gt; file in my local directory with the line:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;path/to/template.html:&amp;lt;lineno&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&amp;hellip; but that didn&amp;rsquo;t work.&lt;/p&gt;&#xA;&lt;p&gt;What worked was to figure out &lt;a href=&#34;https://github.com/pallets/jinja/blob/main/src/jinja2/environment.py#L1301&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;the line that&#xA;says&lt;/a&gt;&#xA;:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;return self.environment.concat(self.root_render_func(ctx))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&amp;hellip; inside the the jinja codebase, and put a breakpoint on that (which&#xA;for me was on line 1299, but might vary depending on version):&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
