malnvenshorn / OctoPrint-CostEstimation

OctoPrint plugin to display the estimated print cost for the loaded model
GNU Affero General Public License v3.0
23 stars 19 forks source link

ERROR - Error while trying to migrate settings for plugin costestimation, ignoring it #12

Closed xefil closed 6 years ago

xefil commented 6 years ago

Hello,

I'm getting this error after installing your plugin, and the Cost is not shown:

2018-05-22 18:14:25,108 - octoprint.server - ERROR - Error while trying to migrate settings for plugin costestimation, ignoring it
Traceback (most recent call last):
  File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint/server/__init__.py", line 433, in run
    settings_plugin_config_migration_and_cleanup(implementation._identifier, implementation)
  File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint/server/__init__.py", line 418, in settings_plugin_config_migration_and_cleanup
    settings_migrator(settings_version, stored_version)
  File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint_costestimation/__init__.py", line 47, in on_settings_migrate
    filaments[0][entry.replace("OfFilament", "")] = value
TypeError: 'NoneType' object has no attribute '__getitem__'

Any idea?

Thanks, Simon

malnvenshorn commented 6 years ago

Is this your first installation or are you updating? If the latter one, from which version?

xefil commented 6 years ago

Hello, Fresh install, but the only thing I've done was copying the filament.db (cannot remember the exact file name, have not the board here) from another Octoprint setup. The filament db is correctly shown in the new OctoPrint setup. Could this cause issues? I would avoid to re-copy manually all my filaments to the new installation. The rest is a plain OctpPi image (Prusa MK3 version), downloaded here: https://www.prusa3d.com/download-prusaprint I try to find out the versions, but should be both coming from the last one. Is there a way to try the cost plugin from cli? I can remember form the other RPi it takes a lot sometimes. Thanks! Simon

malnvenshorn commented 6 years ago

Did some testing at it seems that this error appears, when updating from a version below 1.0 to a version >= 2.0.

The filament.db has nothing to do with this plugin. Maybe you also copied the config.yaml from another OctoPrint instance where a previous version of the CostEstimation plugin was installed?!

Please try the version from the develop branch and see if it fixes your issue.

Edit: Ah it appears also with first installations, but should be fixed with the commit below.

xefil commented 6 years ago

Ok, I'll try it later and let you know. From config.yaml I should have copied only the content of the plugin order, but it's referred to the config.yaml of octoprint (I don't know if it has the same file into the plugin folder). I'll let you know later, thanks! Simon

xefil commented 6 years ago

Hello @malnvenshorn ! I've downloaded the devel.zip version. Could you explain me how to install it correctly? I've tried:

pi@octopi-mk3:~/software/OctoPrint-CostEstimation-develop $ python setup.py 
Traceback (most recent call last):
  File "setup.py", line 2, in <module>
    from setuptools import setup
ImportError: No module named setuptools

It's prefer to shutdown OctoPi as well? Thanks, Simon

malnvenshorn commented 6 years ago

You can either install it by uploading the archive or by using the URL in the plugin manager. See this link for more https://plugins.octoprint.org/help/installation/

xefil commented 6 years ago

Oh thanks, the RTFM always works :-) Well, the update works. Seems now the Cost calculation is very fast. I'll try it with some new objects. Thanks for the support! Simon PS: I let you close the case to append infos if needed.

malnvenshorn commented 6 years ago

Published the new Version.

Btw. it's possible to add comments even to closed issues as long as the conversations isn't locked :wink:

xefil commented 6 years ago

Uh, ok, danke sehr again ;-)

xefil commented 6 years ago

Sorry @malnvenshorn I've a last question. Now I've uploaded another part and the cost doesn't shows up. It's a 24MB gcode. I'm noticing a octoprint analysis gcode process is taking a lot of resources. I'm on a Raspberry Pi Zero, so not so much performances available. Is this process stopping (or needed) to get the Cost result? Thanks, Simon

malnvenshorn commented 6 years ago

OctoPrint calculates the required filament length and the estimated print time during the analyzing process. Both information are needed to calculate the print costs.

I know how long it can take for the raspberry to parse the gcode file. That's why I also wrote the MetadataPreprocessor plugin. It's experimental, but so far I haven't noticed any issues.

xefil commented 6 years ago

Ok, that sounds great! The 25MB files tokes 41minutes to be analyzed, and then:

Filament (Tool 0): 49.20m / 145.57g
Approx. Total Print Time: 8.5 hours
Cost: 3.91 €

Installing the plugin (and restarted) I've seen it has logged:

2018-05-24 16:58:25,392 - octoprint.filemanager.analysis - INFO - Starting analysis of local:01_Prusa_Enclosure_Bottom_Corners.gcode
2018-05-24 16:58:25,407 - octoprint.filemanager.analysis - INFO - Invoking analysis command: /home/pi/oprint/bin/python2 -m octoprint analysis gcode --speed-x=10200 --speed-y=10200 --max-t=10 --throttle=0.0 --throttle-lines=100 /home/pi/.octoprint/uploads/01_Prusa_Enclosure_Bottom_Corners.gcode
2018-05-24 16:58:25,433 - octoprint.plugins.metadatapreprocessor - INFO - Aborting analysis of local:01_Prusa_Enclosure_Bottom_Corners.gcode
2018-05-24 16:58:25,579 - octoprint.plugins.metadatapreprocessor - INFO - Looking for metadata in local:01_Prusa_Enclosure_Bottom_Corners.gcode
2018-05-24 16:58:25,601 - octoprint.plugins.metadatapreprocessor - INFO - Metadata tag not found at the beginning of the file
2018-05-24 16:58:25,605 - octoprint.plugins.metadatapreprocessor - INFO - Requeuing local:01_Prusa_Enclosure_Bottom_Corners.gcode for analysis by octoprint
2018-05-24 16:58:25,626 - octoprint.filemanager.analysis - INFO - Starting analysis of local:01_Prusa_Enclosure_Bottom_Corners.gcode
2018-05-24 16:58:25,662 - octoprint.filemanager.analysis - INFO - Invoking analysis command: /home/pi/oprint/bin/python2 -m octoprint analysis gcode --speed-x=10200 --speed-y=10200 --max-t=10 --throttle=0.0 --throttle-lines=100 /home/pi/.octoprint/uploads/01_Prusa_Enclosure_Bottom_Corners.gcode

Is the metadata information taken from the comments? Looking inside the gcode, I can see the length:

; filament used = 49181.0mm (118.3cm3)
; filament used = 147.9
; total filament cost = 0.0
; estimated printing time = 13h 2m 14s

But it's at the END of the file. It was generated with Slic3r 1.39.1 (Prusa Edition).

Hope I've understood it correctly. I could raise a case in your second project

Simon

malnvenshorn commented 6 years ago

Yes it would be more suited there.

As stated in the logs Metadata tag not found at the beginning of the file the metadata has to be at the beginning of the file. I don't know why it's located at the end :confused: