I'm trying to get the Yahoo! BOSS package working, but when I try to run the example file I get the following error:
$ python examples/ex5.py
File "examples/ex5.py", line 28
tb = db.group(by=["yn$title"], key="rank", reducer=lambda d1,d2: d1+d2, as="total", table=tb, norm=text.norm)
^
SyntaxError: invalid syntax
This particular error only occurs in Python 2.6. When I attempt to run in Python 2.5, this error does not occur (but it throws other errors because I was haven't installed a number of other supporting packages in 2.5).
Note that all the example files fail on this db.group function, with the carat highlighting "as" in each case.
Is there a 2.6-related change that could be causing this error?
as
was a pseudo-keyword in 2.5, it's become a full-fledged keyword in 2.6 -- that's definitely the cause of your problem!As for the workaround, try adding a
**{'as': 'total'}
at the end of your call and remove the plainas='total'
-- that should work.