Hi, I've recently reinstalled SUIT on my site using easy_install in virtualenv, and I for some reason am getting a SyntaxError. The error is as follows:
Traceback (most recent call last): File "index.py", line 13, in <module> from rulebox import templating File "/home/toxic_elegant/local/lib/python2.5/site-packages/rulebox-1.1.1-py2.5.egg/rulebox/templating.py", line 543 except Exception as e: ^ SyntaxError: invalid syntax
The output above comes from cgitb from my shell. The site is producing a 500 error which is possibly unrelated. Here is the code for the page:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
#!/usr/bin/env python print "Content-type: text/html\n\n" import cgitb; cgitb.enable() from wsgiref.handlers import CGIHandler from beaker.middleware import SessionMiddleware from weberror.errormiddleware import ErrorMiddleware from webob import Request, Response import elixir from sqlalchemy import create_engine import suit from rulebox import templating import model import helpers rules = templating.rules.copy() rules['[call'] = rules['[call'].copy() rules['[transform'] = rules['[transform'].copy() rules['[call']['var']['var']['owner'] = helpers elixir.metadata.bind = create_engine('') elixir.setup_all() def app(environ, start_response): session = environ['beaker.session'] helpers.session = session request = Request(environ) helpers.request = request response = Response() headers = [('Content-type', 'text/html')] page = request.GET.get('id', 'main') top = open('top.tpl').read() template = open('%s.tpl' % page).read() bottom = open('bottom.tpl').read() content = top + template + bottom start_response('200 OK', headers) return [str(suit.execute(rules, content))] session_opts = { 'session.data_dir': '', 'session.type': 'file', 'session.expires': 'false' } app = ErrorMiddleware(app, debug=True) app = SessionMiddleware(app, session_opts) CGIHandler().run(app)
I figured out the problem and posted it in the Bugs forum. Turns out you can't say 'except Exception as e:' in Python 2.5 and lower.
Log in to post a comment.
Hi, I've recently reinstalled SUIT on my site using easy_install in virtualenv, and I for some reason am getting a SyntaxError. The error is as follows:
The output above comes from cgitb from my shell. The site is producing a 500 error which is possibly unrelated. Here is the code for the page:
I figured out the problem and posted it in the Bugs forum. Turns out you can't say 'except Exception as e:' in Python 2.5 and lower.