miracle2k/webassets — Issue #75: "IOError" in merge.py
Author: jzempel
Created: 2011-10-27 03:03:09+00:00
State: open

I like to keep my precompiled CSS in one directory (i.e. ".../_css") and then output compiled/compressed CSS to a production location (i.e. ".../css"). In a fresh deployment, if I've failed to create the /css tree structure, webassets fails on ``MemoryHunk.save()``. Here is part of a sample stack trace:

File "/application/blueprints/web2/templates/web2/commons/landing.html", line 3, in block "css"
{% assets "web2/_css/base.ccss", "web2/_css/commons/landing.ccss",
File "/.virtualenvs/site/lib/python2.7/site-packages/webassets/ext/jinja2.py", line 102, in _render_assets
'filters': filter}).urls(env=env)
File "/.virtualenvs/site/lib/python2.7/site-packages/webassets/bundle.py", line 448, in urls
urls.extend(bundle._urls(env, extra_filters, *args, **kwargs))
File "/.virtualenvs/site/lib/python2.7/site-packages/webassets/bundle.py", line 421, in _urls
*args, **kwargs)
File "/.virtualenvs/site/lib/python2.7/site-packages/webassets/bundle.py", line 350, in _build
hunk.save(env.abspath(self.output))
File "/.virtualenvs/site/lib/python2.7/site-packages/webassets/merge.py", line 96, in save
f = open(filename, 'wb')
IOError: [Errno 2] No such file or directory: '/application/blueprints/web2/static/css/commons/landing.css'

I'm using the Flask-Assets extension on top of webassets. At the very least, it would be great if webassets provided a configuration setting (perhaps ``False`` by default) that ensures the output directory structure will be created if it doesn't already exist.