Feature, bug or user issue?

I have {% snippet 'doSmartPreheat' %} in my Before print job starts GCode scripts. While tracking down an unrelated problem I wanted to disable this, rather than delete it (I sooo lazy) I commented it out with a semicolon. Semicolon is ignored, smart preheat is performed.

That would be a user issue here, unfortunately. The plugin 'Smart Preheat' and it's gcode script would inject something with multiple lines - I don't know what they are, so here's an example:

M104 S200
M109 S50
M140 S200

In your gcode script, you have this:

; {% snippet 'doSmartPreheat' %}

When rendered, it will end up looking something like this:

; M104 S200
M109 S50
M140 S200

So the comment is only in front of the first line.

If you want to comment out the template-stuff, then you must wrap it like this: {# <thing> #}

The documentation for the Jinja2 template engine is below:
Jinja โ€” Jinja Documentation (2.11.x) (palletsprojects.com)

1 Like

Small correction, rather use this documentation:

http://jinja.octoprint.org/

OctoPrint still relies on an older version of Jinja because they changed behaviour in a backwards incompatible way at some point (classic case of an undocumented but widely used feature turning out to actually be a bug).

That was changed back in 1.4.1, we're on the latest Jinja release that still keeps Python 2 around :wink:

Damn... I totally forgot about that one :joy: Thanks for the correction :grinning_face_with_smiling_eyes:

1 Like

Thanks guys, perhaps a small lesson for me not be be so lazy