If I have a filament in spoolman, but don't set a color for it (my case is for a misc spool where color could be anything), when trying to set it as active in openspoolman, I get an error in openspoolman, and I see this in the logs:
Traceback (most recent call last):
File "/home/app/app.py", line 286, in home
return render_template('index.html', success_message=success_message, ams_data=ams_data, vt_tray_data=vt_tray_data, issue=issue)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/app/venv/lib/python3.12/site-packages/flask/templating.py", line 150, in render_template
return _render(app, template, context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/app/venv/lib/python3.12/site-packages/flask/templating.py", line 131, in _render
rv = template.render(context)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/app/venv/lib/python3.12/site-packages/jinja2/environment.py", line 1295, in render
self.environment.handle_exception()
File "/home/app/venv/lib/python3.12/site-packages/jinja2/environment.py", line 942, in handle_exception
raise rewrite_traceback_stack(source=source)
File "/home/app/templates/index.html", line 3, in top-level template code
{% from 'fragments/ams_metrics.html' import humidity_display %}
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/app/templates/base.html", line 119, in top-level template code
{% block content %}{% endblock %}
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/app/templates/index.html", line 28, in block 'content'
{% include 'fragments/tray.html' %}
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/app/templates/fragments/tray.html", line 83, in top-level template code
color: {% if color_is_dark(tray_data.spool_color) %}#FFFFFF{% else %}#000000{% endif %}">
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/app/frontend_utils.py", line 6, in color_is_dark
r = int(color[0:2], 16) # Hex to R
^^^^^^^^^^^^^^^^^^^
ValueError: invalid literal for int() with base 16: ''
Traceback (most recent call last):
File "/home/app/app.py", line 286, in home
return render_template('index.html', success_message=success_message, ams_data=ams_data, vt_tray_data=vt_tray_data, issue=issue)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/app/venv/lib/python3.12/site-packages/flask/templating.py", line 150, in render_template
return _render(app, template, context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/app/venv/lib/python3.12/site-packages/flask/templating.py", line 131, in _render
rv = template.render(context)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/app/venv/lib/python3.12/site-packages/jinja2/environment.py", line 1295, in render
self.environment.handle_exception()
File "/home/app/venv/lib/python3.12/site-packages/jinja2/environment.py", line 942, in handle_exception
raise rewrite_traceback_stack(source=source)
File "/home/app/templates/index.html", line 3, in top-level template code
{% from 'fragments/ams_metrics.html' import humidity_display %}
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/app/templates/base.html", line 119, in top-level template code
{% block content %}{% endblock %}
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/app/templates/index.html", line 28, in block 'content'
{% include 'fragments/tray.html' %}
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/app/templates/fragments/tray.html", line 83, in top-level template code
color: {% if color_is_dark(tray_data.spool_color) %}#FFFFFF{% else %}#000000{% endif %}">
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/app/frontend_utils.py", line 6, in color_is_dark
r = int(color[0:2], 16) # Hex to R
^^^^^^^^^^^^^^^^^^^
ValueError: invalid literal for int() with base 16: ''
...
[2025-12-24 19:36:05,875] ERROR in app: Exception on /fill [GET]
Traceback (most recent call last):
File "/home/app/venv/lib/python3.12/site-packages/flask/app.py", line 1511, in wsgi_app
response = self.full_dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/app/venv/lib/python3.12/site-packages/flask/app.py", line 919, in full_dispatch_request
rv = self.handle_user_exception(e)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/app/venv/lib/python3.12/site-packages/flask/app.py", line 917, in full_dispatch_request
rv = self.dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^
File "/home/app/venv/lib/python3.12/site-packages/flask/app.py", line 902, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/app/app.py", line 86, in fill
setActiveSpool(ams_id, tray_id, spool_data)
File "/home/app/app.py", line 232, in setActiveSpool
ams_message["print"]["tray_color"] = spool_data["filament"]["multi_color_hexes"].split(',')[0].upper() + "FF"
~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^
KeyError: 'multi_color_hexes'
ValueError: invalid literal for int() with base 16: ''
is the one that makes it back to the webui after a 500.
I think it just doesn't know what to do if a color isn't set in spoolman.
Optimally: It should be able to handle a no-color spool. For now, I just set this spool to black to workaround.
If I have a filament in spoolman, but don't set a color for it (my case is for a misc spool where color could be anything), when trying to set it as active in openspoolman, I get an error in openspoolman, and I see this in the logs:
This:
is the one that makes it back to the webui after a 500.
I think it just doesn't know what to do if a color isn't set in spoolman.
Optimally: It should be able to handle a no-color spool. For now, I just set this spool to black to workaround.
Thanks!