Hi everyone! I am making a post-processing script to add a Klipper macro after every line in the file. Everything works until I try to save the sliced gcode when it gives me this error: 'str' object does not support item assignment. If anyone could explain to me what I messed up in the script, it would be a great help.
This is my script:
from ..Script import Script
class AddLoggingGcode(Script):
def _init_(self):
super()._init_()
def getSettingDataString(self):
return """{
"name": "Add logging Gcode",
"key": "AddLoggingGcode",
"metadata": {},
"version": 2,
"settings": {}
}"""
def execute(self, data):
new_data = []
for layer in data:
lines = layer.split("\n")
for line in lines:
new_data.append(line + "\nLog_FILE")
return new_data