0

I've noticed this happens sometimes, usually I switch to lambda, but was wondering what I am doing that is causing it:

AttributeError: 'functools.partial' object has no attribute '__module__'

Appears with:

def f(div, x):
    total = 0
    for row in x.iterrows():
        if row["DEPARTMENT DESC"] in div:
            total += row["TOTAL DIR COST"]

called using: functools.partial(f,room)

I would be very thankful for any help!

Cenoc
  • 11,172
  • 21
  • 58
  • 92
  • 1
    Could you post a minimal example that reproduces the error? It doesn't look like the problem is here – Ricardo Cárdenes Oct 30 '14 at 12:17
  • 2
    The problem is not with the partial call itself, but with what happens to the result afterwards. Presumably you're sending it through some code that expects a function object. Function and lambda objects have a `__module__` attribute, but partial objects don't. So when that code treats it like a regular function, it causes an error. It's hard to say more without seeing full code that reproduces the problem. – Kevin Oct 30 '14 at 12:26

0 Answers0