cesarvandevelde / OctoPrint-M73Progress

A plugin to update the built-in progress bar on your printer's LCD.
22 stars 5 forks source link

The plugin causes an exception due to missing _progress #10

Closed Poikilos closed 4 years ago

Poikilos commented 4 years ago
2020-01-24 16:24:49,230 - octoprint.plugin - ERROR - Error while calling plugin m73progress
Traceback (most recent call last):
  File "/home/pi/OctoPrint/venv/local/lib/python2.7/site-packages/octoprint/plugin/__init__.py", line 219, in call_plugin
    result = getattr(plugin, method)(*args, **kwargs)
  File "/home/pi/OctoPrint/venv/local/lib/python2.7/site-packages/octoprint_m73progress/__init__.py", line 49, in on_event
    self._progress.reset()
AttributeError: 'M73progressPlugin' object has no attribute '_progress'
cesarvandevelde commented 4 years ago

How frequently do you get this error? Does it always happen, or only sporadically?

Poikilos commented 4 years ago

It appears to have only happened once. Therefore, it may be something odd having to do with refreshing the page while the OctoPrint interface is initializing, but that's only a guess. I couldn't reproduce it by manually doing that. The octoprint version is 1.3.12 and the plugin version is 0.2.0 from pip

amittel commented 4 years ago

I installed the plugin via the plugin manager yesterday. I kind of have the same error

2020-03-29 08:39:40,728 - octoprint.printer.standard.job - INFO - Print job started - origin: local, path: SpringFrameFront_FilamentWorld-1.75.gcode, owner: _admin, user: _admin
2020-03-29 08:39:40,742 - octoprint.plugin - ERROR - Error while calling plugin m73progress
Traceback (most recent call last):
  File "/home/octopi/OctoPrint/local/lib/python2.7/site-packages/octoprint/plugin/__init__.py", line 224, in call_plugin
    result = getattr(plugin, method)(*args, **kwargs)
  File "/home/octopi/OctoPrint/local/lib/python2.7/site-packages/octoprint_m73progress/__init__.py", line 49, in on_event
    self._progress.reset()
AttributeError: 'M73progressPlugin' object has no attribute '_progress'
2020-03-29 08:39:40,751 - octoprint.util.comm - INFO - M110 detected, setting current line number to 0

I had no progress bar during the print. At the end it switched to a full progress bar.


OctoPrint 1.4.0 Python 2.7 Pluginversion 0.2.0

amittel commented 4 years ago

I made some more prints and I can confirm, that at the beginning of every print I have the same error.

2020-03-30 08:43:01,575 - octoprint.printer.standard.job - INFO - Print job selected - origin: local, path: MainSpring_FilamentWorld-1.75.gcode, owner: _admin, user: _admin
2020-03-30 08:43:01,597 - octoprint.util.comm - INFO - Changing monitoring state from "Operational" to "Starting"
2020-03-30 08:43:01,609 - octoprint.printer.standard.job - INFO - Print job started - origin: local, path: MainSpring_FilamentWorld-1.75.gcode, owner: _admin, user: _admin
2020-03-30 08:43:01,621 - octoprint.plugin - ERROR - Error while calling plugin m73progress
Traceback (most recent call last):
  File "/home/octopi/OctoPrint/local/lib/python2.7/site-packages/octoprint/plugin/__init__.py", line 224, in call_plugin
    result = getattr(plugin, method)(*args, **kwargs)
  File "/home/octopi/OctoPrint/local/lib/python2.7/site-packages/octoprint_m73progress/__init__.py", line 49, in on_event
    self._progress.reset()
AttributeError: 'M73progressPlugin' object has no attribute '_progress'
2020-03-30 08:43:01,639 - octoprint.util.comm - INFO - M110 detected, setting current line number to 0
2020-03-30 08:43:01,656 - octoprint.util.comm - INFO - Changing monitoring state from "Starting" to "Printing"
cesarvandevelde commented 4 years ago

@amittel Have you restarted OctoPrint since installing the plugin?

The _progress object is created right after octoprint startup and gets used during print events. It doesn't make sense to me that the plugin would receive a PRINT_STARTED event before the on_after_startup event. Unless if the plugin is used right after installation, maybe (hence my restart theory).

amittel commented 4 years ago

I investigated a little further and can tell that it has nothing to do with a restart.

I did a complete new venv install mit py3.7 and set it up. I've made a print. Got the error. Now doing a second print without restarting or anything. Just hitted print. Same error. So I have no clue.

Btw: I have no inputform under settings for the plugin. Maybe there is a connection? grafik

Log

Log ``` 2020-04-03 14:49:00,004 - octoprint.server.heartbeat - INFO - Server heartbeat <3 2020-04-03 14:49:00,035 - octoprint.server - INFO - --- Log roll over detected --------------------------------------------------- 2020-04-03 14:49:00,036 - octoprint.server - INFO - OctoPrint 1.4.0 2020-04-03 14:49:00,041 - octoprint.plugin.core - INFO - 15 plugin(s) registered with the system: | Action Command Prompt Support (bundled) = /home/octopi/OctoPrint/lib/python3.7/site-packages/octoprint/plugins/action_command_prompt | Announcement Plugin (bundled) = /home/octopi/OctoPrint/lib/python3.7/site-packages/octoprint/plugins/announcements | Anonymous Usage Tracking (bundled) = /home/octopi/OctoPrint/lib/python3.7/site-packages/octoprint/plugins/tracking | Application Keys Plugin (bundled) = /home/octopi/OctoPrint/lib/python3.7/site-packages/octoprint/plugins/appkeys | Backup & Restore (bundled) = /home/octopi/OctoPrint/lib/python3.7/site-packages/octoprint/plugins/backup | Core Wizard (bundled) = /home/octopi/OctoPrint/lib/python3.7/site-packages/octoprint/plugins/corewizard | Discovery (bundled) = /home/octopi/OctoPrint/lib/python3.7/site-packages/octoprint/plugins/discovery | Error Tracking (bundled) = /home/octopi/OctoPrint/lib/python3.7/site-packages/octoprint/plugins/errortracking | Logging (bundled) = /home/octopi/OctoPrint/lib/python3.7/site-packages/octoprint/plugins/logging | Login UI (bundled) = /home/octopi/OctoPrint/lib/python3.7/site-packages/octoprint/plugins/loginui | M73 Progress Plugin (0.2.0) = /home/octopi/OctoPrint/lib/python3.7/site-packages/octoprint_m73progress | Plugin Manager (bundled) = /home/octopi/OctoPrint/lib/python3.7/site-packages/octoprint/plugins/pluginmanager | Printer Safety Check (bundled) = /home/octopi/OctoPrint/lib/python3.7/site-packages/octoprint/plugins/printer_safety_check | Software Update (bundled) = /home/octopi/OctoPrint/lib/python3.7/site-packages/octoprint/plugins/softwareupdate | Virtual Printer (bundled) = /home/octopi/OctoPrint/lib/python3.7/site-packages/octoprint/plugins/virtual_printer Prefix legend: ! = disabled, # = blacklisted, * = incompatible 2020-04-03 14:49:00,052 - octoprint.environment - INFO - Detected environment is Python 3.7.3 under Linux (linux). Details: | hardware: | cores: 4 | freq: 1008.0 | ram: 502472704 | os: | id: linux | platform: linux | python: | pip: 20.0.2 | version: 3.7.3 | virtualenv: /home/octopi/OctoPrint 2020-04-03 14:49:00,053 - octoprint.server - INFO - ------------------------------------------------------------------------------ 2020-04-03 14:49:00,217 - octoprint.plugins.tracking - INFO - Sent tracking event ping, payload: {'octoprint_uptime': 253119} 2020-04-03 14:49:00,422 - octoprint.plugins.tracking - INFO - Sent tracking event pong, payload: {'plugins': 'm73progress:0.2.0'} 2020-04-03 14:49:59,200 - octoprint.server.util.sockjs - INFO - Client connection closed: 192.168.1.106 2020-04-03 14:49:59,361 - octoprint.server.util.sockjs - INFO - New connection from client: 192.168.1.106 2020-04-03 14:49:59,484 - octoprint.server.util.flask - INFO - Passively logging in user _admin from 192.168.1.106 2020-04-03 14:49:59,485 - octoprint.access.users - INFO - Cleaning up user session 898574C935C841B7AA4B23C7D091505A for user _admin 2020-04-03 14:49:59,485 - octoprint.access.users - INFO - Cleaning up user session A94AA0430E2E450A95E827A802A42814 for user _admin 2020-04-03 14:49:59,486 - octoprint.access.users - INFO - Cleaning up user session B79851BEA6104F98A4DD3289694B26E0 for user _admin 2020-04-03 14:49:59,486 - octoprint.access.users - INFO - Cleaning up user session B9EF1863EB0145FBAE2EA12293F24FB3 for user _admin 2020-04-03 14:49:59,486 - octoprint.access.users - INFO - Cleaning up user session A2CE4F6C265C49CCAE5675F5219AD8BF for user _admin 2020-04-03 14:49:59,487 - octoprint.access.users - INFO - Cleaning up user session A05B7A5492C4442EB69ED99CABE61A2D for user _admin 2020-04-03 14:49:59,487 - octoprint.access.users - INFO - Cleaning up user session 8620A8F6F2884625B54C03D5BCD87DA9 for user _admin 2020-04-03 14:49:59,487 - octoprint.access.users - INFO - Cleaning up user session 3786809F3F9443B4B79C07E47BE6E263 for user _admin 2020-04-03 14:49:59,488 - octoprint.access.users - INFO - Cleaning up user session 557E9FDB2942433580DBAADB580E1660 for user _admin 2020-04-03 14:49:59,488 - octoprint.access.users - INFO - Cleaning up user session AFEDFD39AFBE48CD81FD70DADFB6310B for user _admin 2020-04-03 14:49:59,490 - octoprint.access.users - INFO - Logged in user: _admin 2020-04-03 14:49:59,549 - octoprint.server.util.sockjs - INFO - User _admin logged in on the socket from client 192.168.1.106 2020-04-03 14:50:16,499 - octoprint.printer.standard.job - INFO - Print job selected - origin: local, path: Bracket-2x_FilamentWorld-1.75.gcode, owner: _admin, user: _admin 2020-04-03 14:50:16,530 - octoprint.util.comm - INFO - Changing monitoring state from "Operational" to "Starting" 2020-04-03 14:50:16,545 - octoprint.printer.standard.job - INFO - Print job started - origin: local, path: Bracket-2x_FilamentWorld-1.75.gcode, owner: _admin, user: _admin 2020-04-03 14:50:16,561 - octoprint.util.comm - INFO - M110 detected, setting current line number to 0 2020-04-03 14:50:16,555 - octoprint.plugin - ERROR - Error while calling plugin m73progress Traceback (most recent call last): File "/home/octopi/OctoPrint/lib/python3.7/site-packages/octoprint/plugin/__init__.py", line 224, in call_plugin result = getattr(plugin, method)(*args, **kwargs) File "/home/octopi/OctoPrint/lib/python3.7/site-packages/octoprint_m73progress/__init__.py", line 49, in on_event self._progress.reset() AttributeError: 'M73progressPlugin' object has no attribute '_progress' 2020-04-03 14:50:16,609 - octoprint.util.comm - INFO - Changing monitoring state from "Starting" to "Printing" 2020-04-03 14:50:16,848 - octoprint.plugins.tracking - INFO - Sent tracking event print_started, payload: {'origin': 'local', 'file': '9c4f09d9aa3d1e6a09a4ffcffdf82332cd4a1db4'} 2020-04-03 14:50:58,229 - octoprint.server.util.sockjs - INFO - Client connection closed: 192.168.1.106 2020-04-03 14:50:58,375 - octoprint.server.util.sockjs - INFO - New connection from client: 192.168.1.106 2020-04-03 14:50:58,496 - octoprint.server.util.flask - INFO - Passively logging in user _admin from 192.168.1.106 2020-04-03 14:50:58,497 - octoprint.access.users - INFO - Cleaning up user session 898574C935C841B7AA4B23C7D091505A for user _admin 2020-04-03 14:50:58,498 - octoprint.access.users - INFO - Cleaning up user session A94AA0430E2E450A95E827A802A42814 for user _admin 2020-04-03 14:50:58,498 - octoprint.access.users - INFO - Cleaning up user session B79851BEA6104F98A4DD3289694B26E0 for user _admin 2020-04-03 14:50:58,498 - octoprint.access.users - INFO - Cleaning up user session B9EF1863EB0145FBAE2EA12293F24FB3 for user _admin 2020-04-03 14:50:58,499 - octoprint.access.users - INFO - Cleaning up user session A2CE4F6C265C49CCAE5675F5219AD8BF for user _admin 2020-04-03 14:50:58,499 - octoprint.access.users - INFO - Cleaning up user session A05B7A5492C4442EB69ED99CABE61A2D for user _admin 2020-04-03 14:50:58,499 - octoprint.access.users - INFO - Cleaning up user session 8620A8F6F2884625B54C03D5BCD87DA9 for user _admin 2020-04-03 14:50:58,500 - octoprint.access.users - INFO - Cleaning up user session 3786809F3F9443B4B79C07E47BE6E263 for user _admin 2020-04-03 14:50:58,500 - octoprint.access.users - INFO - Cleaning up user session 557E9FDB2942433580DBAADB580E1660 for user _admin 2020-04-03 14:50:58,500 - octoprint.access.users - INFO - Cleaning up user session AFEDFD39AFBE48CD81FD70DADFB6310B for user _admin 2020-04-03 14:50:58,502 - octoprint.access.users - INFO - Logged in user: _admin 2020-04-03 14:50:58,544 - octoprint.server.util.sockjs - INFO - User _admin logged in on the socket from client 192.168.1.106 2020-04-03 14:52:31,650 - octoprint.server.util.sockjs - INFO - Client connection closed: 192.168.1.106 2020-04-03 14:52:31,789 - octoprint.server.util.sockjs - INFO - New connection from client: 192.168.1.106 2020-04-03 14:52:31,931 - octoprint.server.util.flask - INFO - Passively logging in user _admin from 192.168.1.106 2020-04-03 14:52:31,932 - octoprint.access.users - INFO - Cleaning up user session 898574C935C841B7AA4B23C7D091505A for user _admin 2020-04-03 14:52:31,932 - octoprint.access.users - INFO - Cleaning up user session A94AA0430E2E450A95E827A802A42814 for user _admin 2020-04-03 14:52:31,933 - octoprint.access.users - INFO - Cleaning up user session B79851BEA6104F98A4DD3289694B26E0 for user _admin 2020-04-03 14:52:31,933 - octoprint.access.users - INFO - Cleaning up user session B9EF1863EB0145FBAE2EA12293F24FB3 for user _admin 2020-04-03 14:52:31,934 - octoprint.access.users - INFO - Cleaning up user session A2CE4F6C265C49CCAE5675F5219AD8BF for user _admin 2020-04-03 14:52:31,934 - octoprint.access.users - INFO - Cleaning up user session A05B7A5492C4442EB69ED99CABE61A2D for user _admin 2020-04-03 14:52:31,935 - octoprint.access.users - INFO - Cleaning up user session 8620A8F6F2884625B54C03D5BCD87DA9 for user _admin 2020-04-03 14:52:31,935 - octoprint.access.users - INFO - Cleaning up user session 3786809F3F9443B4B79C07E47BE6E263 for user _admin 2020-04-03 14:52:31,936 - octoprint.access.users - INFO - Cleaning up user session 557E9FDB2942433580DBAADB580E1660 for user _admin 2020-04-03 14:52:31,937 - octoprint.access.users - INFO - Cleaning up user session AFEDFD39AFBE48CD81FD70DADFB6310B for user _admin 2020-04-03 14:52:31,942 - octoprint.access.users - INFO - Logged in user: _admin 2020-04-03 14:52:32,004 - octoprint.server.util.sockjs - INFO - User _admin logged in on the socket from client 192.168.1.106 2020-04-03 14:58:31,327 - octoprint.server.util.sockjs - INFO - Client connection closed: 192.168.1.106 ```
cesarvandevelde commented 4 years ago

The blank settings page is due to a browser caching issue. Clear your browser cache and it should work. This part is handled by OctoPrint itself, so I don't think I can fix it from my side.

As for the main issue: the root cause is that the _progress object gets used before it is created. This object is created in the on_after_startup() method, which is called by OctoPrint during startup.

If my theory is correct, the following sequence should cause the error:

The following sequence should not cause an error:

amittel commented 4 years ago

Ok. I got it running. My problem was not realted to the plugin. Restarting Octoprint was not working proberly (had to fix/config pam.d). After fixing it and restarting and printing, the progressbar works now. Thanks for your help!

cesarvandevelde commented 4 years ago

I've made a small change so that you're prompted to restart OctoPrint after installation: bugfix/restart

Can you try it out before I push the update?

gizmocuz commented 4 years ago

@cesarvandevelde , I did not had the crash before and was just browsing the issues before I was considering installing this plugin. I can confirm that your bugfix/restart is asking to restart OctoPrint, and succeeded Made a test print, and the progress bar is updating beautifully! Thanks for this plugin ! I wish I found this months ago ;)

cesarvandevelde commented 4 years ago

Thanks for the heads-up, @gizmocuz! I've pushed out the fix in a new release. Hopefully, that's the end of that. :)