I have a script that I wrote for python 2.7 on a windows box. I have it working on a couple of different machines, so I know it ‘moves’ OK.
I am now setting up a ubuntu box (v12.04).
The same code fails in ubuntu:
instance = session.query(formats_table).\
filter(formats_table.c.formatid==FormatID,
formats_table.c.puid==PUID,
formats_table.c.formatversion==FormatVersion,
formats_table.c.formatmimetype==FormatMIMEType).all()
In windows it runs fine and causes no issues
In ubuntu it fails with:
TypeError: <lamba>() takes exactly 2 arguments (5 given)
What can I do to find out what’s going wrong?
I am assuming that this line is being parsed as 5 different arguments, and not two (session.query) and (filter), which suggests that the brackets are not being parsed correctly?
You’ve got two different versions of SQLAlchemy.
SQLAlchemy’s
filtermethod:Note that prior to 0.7.5, you couldn’t have multiple criterion in a single
filtercall — you had to chain multiplefiltercalls to get the same effect. In your case, that would look like:So the “arguments” being referred to are the keyword arguments passed to
filter— you can only have one in the version of SQLAlchemy that ships with your version of Ubuntu, and you provide four. The other argument that you don’t see is the instance object (normally calledself) that is automatically passed when you call an instance method.