app Engine + cssutils problem

32 views
Skip to first unread message

xcession

unread,
May 3, 2009, 1:56:21 PM5/3/09
to cssutils
I'm investigating google app engine for a little css-related project,
but am having trouble doing the simplest things and I'm stumped as to
why.

I've gone through the Guestbook example and have modified it only a
little thus:

<snip>
import os
import codecs
import cssutils

from google.appengine.ext.webapp import template
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app

class MainPage(webapp.RequestHandler):

def get(self):
css = '''
body {
color: blue;
font: normal 100% sans-serif;
}
p {
color: green;
font-size: 2em;
}
.x {
color: black;
}
'''
sheet = cssutils.parseString(css)

</snip>

But when I run it, i'm getting the errors:

Traceback (most recent call last):
File "C:\Program Files\Google\google_appengine\google\appengine\ext
\webapp\__init__.py", line 501, in __call__
handler.get(*groups)
File "c:\test\helloworld.py", line 31, in get
sheet = cssutils.parseString(css)
File "c:\test\cssutils\__init__.py", line 150, in parseString
return CSSParser().parseString(*a, **k)
File "c:\test\cssutils\parse.py", line 95, in parseString
cssText = codecs.getdecoder('css')(cssText, encoding=encoding)[0]
File "C:\test\cssutils\codec.py", line 200, in decode
if _encoding == "css":
TypeError: 'NoneType' object is not callable

I'm on windows, python 2.5, cssutils-0.9.6a3. I've had to copy the
cssutils and encutils folder from site-packages into my c:\test
folder, as per google app engine instructions.

If I remove all the app-engine specifics, basically ending up with
just the imports and a "main()" function in the file, then run it on
its own with python, it works fine.

I'm a python noob anyway, so this could be something embarrassingly
simple, but if so I can't see it!

Hope you can help

xcession

unread,
May 3, 2009, 2:43:18 PM5/3/09
to cssutils
Some further googling suggests that the codecs lib isn't supported by
GAE as they've rolled their own. Is this actually an issue or just
someone else's conjecture?
Reply all
Reply to author
Forward
0 new messages