pietroalbini/lektor-minify

Getting error 'MinifyPlugin' object has no attribute 'seen_artifacts'

tariquesani opened this issue · 9 comments

running lektor --project ../newblog/ server -h 0.0.0.0 -f minify

I get

Traceback (most recent call last): File "/home/tariquesani/Projects/lektor/venv/lib/python2.7/site-packages/flask/app.py", line 1994, in __call__ return self.wsgi_app(environ, start_response) File "/home/tariquesani/Projects/lektor/venv/lib/python2.7/site-packages/flask/app.py", line 1985, in wsgi_app response = self.handle_exception(e) File "/home/tariquesani/Projects/lektor/venv/lib/python2.7/site-packages/flask/app.py", line 1540, in handle_exception reraise(exc_type, exc_value, tb) File "/home/tariquesani/Projects/lektor/venv/lib/python2.7/site-packages/flask/app.py", line 1982, in wsgi_app response = self.full_dispatch_request() File "/home/tariquesani/Projects/lektor/venv/lib/python2.7/site-packages/flask/app.py", line 1614, in full_dispatch_request rv = self.handle_user_exception(e) File "/home/tariquesani/Projects/lektor/venv/lib/python2.7/site-packages/flask/app.py", line 1517, in handle_user_exception reraise(exc_type, exc_value, tb) File "/home/tariquesani/Projects/lektor/venv/lib/python2.7/site-packages/flask/app.py", line 1612, in full_dispatch_request rv = self.dispatch_request() File "/home/tariquesani/Projects/lektor/venv/lib/python2.7/site-packages/flask/app.py", line 1598, in dispatch_request return self.view_functions[rule.endpoint](**req.view_args) File "/home/tariquesani/Projects/lektor/lektor/admin/modules/serve.py", line 151, in serve_artifact return serve_up_artifact(path) File "/home/tariquesani/Projects/lektor/lektor/admin/modules/serve.py", line 130, in serve_up_artifact artifact_name, filename = li.resolve_artifact('/' + path, pad) File "/home/tariquesani/Projects/lektor/lektor/admin/webui.py", line 60, in resolve_artifact prog, _ = builder.build(source) File "/home/tariquesani/Projects/lektor/lektor/builder.py", line 1103, in build source=source, prog=prog) File "/home/tariquesani/Projects/lektor/lektor/pluginsystem.py", line 160, in emit rv[plugin.id] = handler(**kwargs) File "/home/tariquesani/.cache/lektor/packages/cbce499f658a58ac87b6d5f9a0d5bda1/lektor_minify/__init__.py", line 84, in on_after_build artifacts = set(build_state.updated_artifacts) - self.seen_artifacts AttributeError: 'MinifyPlugin' object has no attribute 'seen_artifacts'

I can't reproduce this issue, unfortunately. Which version of Lektor are you using? From the traceback I guess this is on Python 2.7.

By the way, this is strange: it seems like the before-build-all event isn't called before after-build, and self.seen_artifacts is defined in the first one.

Oh! Forgot to mention I am using the latest master branch from the repo on Ubuntu 16.04

Also this happens only with lektor serve and not with lektor build. I guess sequence of events must be different in both cases.

Does this also happen with build --watch?

Will try out tomorrow and let you know.

Could you try with commit 5364de6? I refactored the plugin to avoid using the before-build-all event (global state is bad anyway), so the issue should be fixed.

I'm still not able to reproduce the issue myself, but looking at the stack trace the only thing I can think about is that the before-build-all event wasn't fired before after-build. If the problem is this (and the commit fixes it) I would open an issue in the Lektor project.

Thanks! Your last commit seems to have solved the problem. The plugin works well 👍

Wonderful! I'll make a new release in the next few days.

Fix released in lektor-minify 1.2.