Skip to content

TypeError: unsupported operand type(s) for -: 'datetime.datetime' and 'NoneType' #27

Description

@Signum

Version: 1.2

Thanks for maintaining the plugin. Works well on my Elegoo Neptune 3. However at "random" times the main log file is spammed with this message:

2022-11-26 21:09:56,650 - octoprint.util.comm - ERROR - Error while processing hook smartfilamentsensor for phase sent:
Traceback (most recent call last):
  File "/home/pi/oprint/lib/python3.7/site-packages/octoprint/util/comm.py", line 4670, in _process_command_phase
    tags=tags,
  File "/home/pi/oprint/lib/python3.7/site-packages/octoprint/util/__init__.py", line 1688, in wrapper
    return f(*args, **kwargs)
  File "/home/pi/oprint/lib/python3.7/site-packages/octoprint_smart_filament_sensor/__init__.py", line 401, in distance_detection
    self.calc_distance(float(extruder))
  File "/home/pi/oprint/lib/python3.7/site-packages/octoprint_smart_filament_sensor/__init__.py", line 272, in calc_distance
    if (datetime.now() - self.last_movement_time).total_seconds() > 10:
TypeError: unsupported operand type(s) for -: 'datetime.datetime' and 'NoneType'

It can easily be reproduced here using the VIRTUAL printer.

During a print yesterday that exception was raised 27,000 times.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions