Hi,

I'm trying to figure out a way how to bundle/combine JavaScript files.
I found some packages for Django, but none for Pyramid (1.2)

see http://djangopackages.com/grids/g/asset-managers/

That's where I found 'webassets' -> 
http://djangopackages.com/packages/p/webassets/

My question is, if there's another, better package that does the job?
Or how to get this one to work, because my code doesn't:


# file: assets.py

from os import path
from webassets import Bundle, Environment

env = Environment(path.join(path.dirname(__file__), 'static'), '/
static')
env.expire = False

bundle = Bundle('js/libs/json2.js', 'js/libs/jquery-1.7.1.min.js',
filters='jsmin', output='js/my.bundle.js')
env.register('test', bundle)

env['test'].urls()  # <== ERROR thrown here

if __name__== "__main__":
    # If this file is called directly, do a manual build.
    bundle.build()


the 'urls()' method throws this error:

Starting subprocess with file monitor
Traceback (most recent call last):
  File "C:\dev\repo\Scripts\paster-script.py", line 8, in <module>
    load_entry_point('PasteScript==1.7.5', 'console_scripts', 'paster')
()
  File "C:\dev\repo\lib\site-packages\paste\script\command.py", line
104, in run
    invoke(command, command_name, options, args[1:])
  File "C:\dev\repo\lib\site-packages\paste\script\command.py", line
143, in invoke
    exit_code = runner.run(args)
  File "C:\dev\repo\lib\site-packages\paste\script\command.py", line
238, in run
    result = self.command()
  File "C:\dev\repo\lib\site-packages\paste\script\serve.py", line
284, in command
    relative_to=base, global_conf=vars)
  File "C:\dev\repo\lib\site-packages\paste\script\serve.py", line
321, in loadapp
    **kw)
  File "C:\dev\repo\lib\site-packages\paste\deploy\loadwsgi.py", line
247, in loadapp
    return loadobj(APP, uri, name=name, **kw)
  File "C:\dev\repo\lib\site-packages\paste\deploy\loadwsgi.py", line
272, in loadobj
    return context.create()
  File "C:\dev\repo\lib\site-packages\paste\deploy\loadwsgi.py", line
710, in create
    return self.object_type.invoke(self)
  File "C:\dev\repo\lib\site-packages\paste\deploy\loadwsgi.py", line
146, in invoke
    return fix_call(context.object, context.global_conf,
**context.local_conf)
  File "C:\dev\repo\lib\site-packages\paste\deploy\util.py", line 56,
in fix_call
    val = callable(*args, **kw)
  File "C:\dev\repo\TestSite\testsite\__init__.py", line 70, in main
    config.scan("testsite")
  File "C:\dev\repo\lib\site-packages\pyramid\config\__init__.py",
line 786, in scan
    scanner.scan(package, categories=categories, onerror=onerror)
  File "C:\dev\repo\lib\site-packages\venusian\__init__.py", line 115,
in scan
    onerror(modname)
  File "C:\dev\repo\lib\site-packages\venusian\__init__.py", line 113,
in scan
    __import__(modname)
  File "C:\dev\repo\TestSite\testsite\assets.py", line 24, in <module>
    env['json'].urls()
  File "C:\dev\repo\lib\site-packages\webassets\bundle.py", line 448,
in urls
    urls.extend(bundle._urls(env, extra_filters, *args, **kwargs))
  File "C:\dev\repo\lib\site-packages\webassets\bundle.py", line 421,
in _urls
    *args, **kwargs)
  File "C:\dev\repo\lib\site-packages\webassets\bundle.py", line 349,
in _build
    extra_filters=extra_filters)
  File "C:\dev\repo\lib\site-packages\webassets\bundle.py", line 294,
in _merge_and_apply
    output_path=output_path))
  File "C:\dev\repo\lib\site-packages\webassets\merge.py", line 135,
in apply_filters
    key = ("hunk", hunk.key(), tuple(filters), type)
  File "C:\dev\repo\lib\site-packages\webassets\merge.py", line 37, in
key
    md5.update(self.data())
  File "C:\dev\repo\lib\site-packages\webassets\merge.py", line 71, in
data
    r = urllib2.urlopen(self.url)
  File "C:\dev\Python27\Lib\urllib2.py", line 126, in urlopen
    return _opener.open(url, data, timeout)
  File "C:\dev\Python27\Lib\urllib2.py", line 394, in open
    response = self._open(req, data)
  File "C:\dev\Python27\Lib\urllib2.py", line 417, in _open
    'unknown_open', req)
  File "C:\dev\Python27\Lib\urllib2.py", line 372, in _call_chain
    result = func(*args)
  File "C:\dev\Python27\Lib\urllib2.py", line 1232, in unknown_open
    raise URLError('unknown url type: %s' % type)
urllib2.URLError: <urlopen error unknown url type: c>


my environment
python 2.7, pyramid 1.2, webassets 0.6, windows 7 64bit

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.

Reply via email to