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 -: 'datetime.datetime' and 'NoneType' #27

Open
Signum opened this issue Nov 26, 2022 · 1 comment

Comments

@Signum
Copy link

Signum commented Nov 26, 2022

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.

@hviet17
Copy link

hviet17 commented Dec 13, 2022

I have uploaded a fix #28, you can install via zip file or here https://github.com/hviet17/Octoprint-Smart-Filament-Sensor/archive/refs/heads/fix-operand.zip

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