How to properly reload gcode after manual edits?

What is the problem?

How to get Octoprint to recognize changes after manually editing a gcode file.

I sometimes upload gcodes sliced in PrusaSlicer for a printer with two extruders, with an M600 added for custom tool change gcode. This works to "fake" something like an MMU/2 by allowing me to change filament in the middle of a layer, but if I print as-is, Octoprint says the printer only has one extruder so it's ignoring the "T0" command. I'll manually edit the gcode file in the uploads directory, but even after doing that and saving the file, Octoprint still prints the errors about the T0 command. I can recheck the file and confirm that there are no remaining ^T[0-9] strings in the gcode.

Seems that Octoprint is caching the file and ignoring my changes. Restarting the Octoprint service sometimes seems to help, but not always.

Somewhat related, if I copy a file at the OS from one Octoprint instance to another, it won't load the PrusaSlicer thumbnails, which makes me think that OS-level operations are missing some fundamental step in Octoprint.

What did you already try to solve it?

Restart Octoprint after editing the file, which usually works, but not always.

Have you tried running in safe mode?

Not yet, don't think it's related to plugins, but can try if that seems like a good idea.

Did running in safe mode solve the problem?

Haven't tried.

Systeminfo Bundle

You can download this in OctoPrint's System Information dialog ... no bundle, no support!)

octoprint-systeminfo-20220801141801.zip (252.1 KB)

Additional information about your setup

OctoPrint version, OctoPi version, printer, firmware, browser, operating system, ... as much data as possible

Octoprint version: 1.8.1
OctoPi version: 0.18.0
Printer: Prusa MK3S
Browser: Chrome on Mac OS, current version.
OS: Mac OS Monterey 12.4

I apply updates to the raspbian OS as they are available, and edit the files in the uploads directory with plain ol' vi.

May workaround for this:

Load another file and then the first file again:

grafik

I think I've tried that, but also expected that restarting the server would be the even bigger hammer approach to the same end.

Doesn't help with the somewhat related issue of thumbnails not showing for files copied at the OS level, but those issues may not be as related as I'm assuming.

Thinking about this some more I have two other options which are better than manually editing after uploading:

  • Save gcode locally, edit as necessary, upload to Octoprint. (duh)
  • Use PrusaSlicer's G-code substitutions under Print Settings/Output options to strip the ^T[0-9] code.

Both of those are probably a better solution than having to restart the server or unload/reload the file.

Still curious about the handling of the thumbnail images when manually copying, but I guess that's something that could be worked around as well. Guess I need to rethink my work flow to fit the tools instead of bodging the tools because I don't wanna change. :laughing:

1 Like

Have you tried the gcode editor plugin for octoprint? I use it fairly often and it updates octoprint to the changes when you save the file. Of course you can't be printing the file when you edit it.

I'll look into that one, thanks!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.