abs(): 'Undefined' Error
Hello! New to RatOS, somewhat familiar with Klipper. Just set up the printer (INDEX) and am getting this message when I try to print:
Error evaluating 'gcode_macro START_PRINT:gcode': TypeError: bad operand type for abs(): 'Undefined'
As far as I can tell is comes to this line here under the RatOS/macros.cfg - [gcode_macro START_PRINT]
{% if svv.idex_xoffset|abs >= (x_parking_space - 0.5) or svv.idex_xoffset|abs >= (dc_parking_space - 0.5) %}
Unfortunately, everything in the RatOS folder appears to be read-only, so I have no idea how to resolve this issue. Any help would be appreciated. I thought about defining an ABS function in printer.cfg, but wasn't sure I could quite pull that off. Besides, it seems no-one else has this problem, so there is probably another solution.
Solution:Jump to solution
Fixed it? I re-entered the configurator wizard and skipped all the board flashing stages.
17 Replies
Haven't seen that one before. Is ratos updated?
yes

Its as if I am just missing part of the config file Does everyone else have the same line under their START_PRINT macro?
yep, that file comes from ratos and is not intended to be edited.
What slicer are you using, and what does your Start Print gcode look like in it?
Using PrusaSlicer 2.9.2
Start CodeL
START_PRINT EXTRUDER_TEMP={first_layer_temperature[0]},{first_layer_temperature[1]} EXTRUDER_OTHER_LAYER_TEMP={temperature[0]},{temperature[1]} BED_TEMP=[first_layer_bed_temperature] START_CHAMBER_TEMP=[chamber_temperature] CHAMBER_TEMP=[chamber_temperature] INITIAL_TOOL={initial_tool} TOTAL_LAYER_COUNT={total_layer_count} X0={first_layer_print_min[0]} Y0={first_layer_print_min[1]} X1={first_layer_print_max[0]} Y1={first_layer_print_max[1]}
It is just the base code from the ratOS website
yep, just double checking 🙂
the way that
abs
is used, it reads like python is trying to interpret it, and not the django. @blacksmithforlife you seen this before?Log files are also referancing Python:
Starting SD card print (position 0)
Error evaluating 'gcode_macro START_PRINT:gcode': TypeError: bad operand type for abs(): 'Undefined'
Traceback (most recent call last):
File "/home/pi/klipper/klippy/extras/gcode_macro.py", line 61, in render
return str(self.template.render(context))
File "/home/pi/klippy-env/lib/python3.9/site-packages/jinja2/environment.py", line 1090, in render
self.environment.handle_exception()
File "/home/pi/klippy-env/lib/python3.9/site-packages/jinja2/environment.py", line 832, in handle_exception
reraise(*rewrite_traceback_stack(source=source))
File "/home/pi/klippy-env/lib/python3.9/site-packages/jinja2/_compat.py", line 28, in reraise
raise value.with_traceback(tb)
File "<template>", line 140, in top-level template code
TypeError: bad operand type for abs(): 'Undefined'
Error evaluating 'gcode_macro START_PRINT:gcode': TypeError: bad operand type for abs(): 'Undefined'
You can see why I wanted to verify your ratos was up to date and macro set up correctly 🙂
Yeah of course. And plainly something is not set up correctly.
Searching this discord for
bad operand type for abs()
and your messages are the only ones with itYeah I could find anything either
even just searching for
bad operand type
yields nothing elseSolution
Fixed it? I re-entered the configurator wizard and skipped all the board flashing stages.
Then had it recompile the config files and now it works.
weird, but happy for the success!
Yup