Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7997953
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T15:05:56+00:00 2026-06-04T15:05:56+00:00

I have a script that I wrote for python 2.7 on a windows box.

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T15:05:57+00:00Added an answer on June 4, 2026 at 3:05 pm

    You’ve got two different versions of SQLAlchemy.

    SQLAlchemy’s filter method:

    filter(*criterion)

    apply the given filtering criterion to a copy of this Query, using SQL expressions.

    e.g.:
    session.query(MyClass).filter(MyClass.name == 'some name')

    Multiple criteria are joined together by AND (new in 0.7.5):

    session.query(MyClass).filter(MyClass.name == 'some name', MyClass.id > 5)

    Note that prior to 0.7.5, you couldn’t have multiple criterion in a single filter call — you had to chain multiple filter calls to get the same effect. In your case, that would look like:

    instance = session.query(formats_table).\
    filter(formats_table.c.formatid==FormatID).\
    filter(formats_table.c.puid==PUID).\
    filter(formats_table.c.formatversion==FormatVersion).\
    filter(formats_table.c.formatmimetype==FormatMIMEType)
    

    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 called self) that is automatically passed when you call an instance method.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wrote a Python script that I need to have installed on Windows Server
I have a Python script I recently wrote that I call using the command
I have a Perl script I wrote for my own personal use that fetches
I wrote a python script that depends on a certain NFS share to be
I wrote Python script that processes big number of large text files and may
I wrote a python script that processes a large amount of downloaded webpages HTML(120K
So I wrote a small python script that allows me to specify some folder
I've wrote a python script that need to pass millions of items to a
i'm working in python 3.2 (newb) on windows machine (though i have ubuntu 10.04
I'm working on Windows with Python 2.6.1. I have a Unicode UTF-16 text file

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.