Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: unsupported operand type(s) for *: 'NoneType' and 'float' #19

Open
guythnick opened this issue Dec 21, 2021 · 1 comment
Open

Comments

@guythnick
Copy link

I am getting an error in the logs that is causing prints to fail. This was after upgrading OctoPrint to 1.7.2. I made no other changes. I also upgraded to Python 3 as well, but I am getting the same error. For some reason it does not like my code snippet, which was not changed from when it was working before the upgrade. Also including that below.

Octoprint - 1.7.2 Python3
OctoPrint-SmartPreheat - 0.6

2021-12-21 15:37:27,720 - octoprint.settings - ERROR - Exception while trying to render script gcode:beforePrintStarted
Traceback (most recent call last):
  File "/home/pi/OctoPrint/venv/lib/python3.7/site-packages/octoprint/settings.py", line 1989, in loadScript
    script = template.render(**context)
  File "/home/pi/OctoPrint/venv/lib/python3.7/site-packages/jinja2/environment.py", line 1090, in render
    self.environment.handle_exception()
  File "/home/pi/OctoPrint/venv/lib/python3.7/site-packages/jinja2/environment.py", line 832, in handle_exception
    reraise(*rewrite_traceback_stack(source=source))
  File "/home/pi/OctoPrint/venv/lib/python3.7/site-packages/jinja2/_compat.py", line 28, in reraise
    raise value.with_traceback(tb)
  File "/home/pi/.octoprint/scripts/gcode/beforePrintStarted", line 1, in top-level template code
    {% snippet 'doSmartPreheat' %}
  File "/home/pi/.octoprint/scripts/gcode/snippets/doSmartPreheat", line 4, in top-level template code
    M190 S{{ (plugins.smartpreheat.bed * 0.8)|round }}
TypeError: unsupported operand type(s) for *: 'NoneType' and 'float'

image

@TheThief
Copy link

I think you need to replace the two {% if printer_profile.heatedBed %} with {% if printer_profile.heatedBed and plugins.smartpreheat.bed != None %}

I just encountered a similar error where a print job skipped my pre-print gcode (both preheating (expected) and homing and auto-leveling (not so expected) commands) when I tried to print a file that had no bed heating commands, so smart preheat couldn't get a bed temp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants