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 8257403
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T02:11:10+00:00 2026-06-08T02:11:10+00:00

I have some functions that process the parameter, like : def createDataModel(objectModel): …… def

  • 0

I have some functions that process the parameter, like :

def createDataModel(objectModel):
    ......
def createLayoutModel(objectModel):
    ......
def createWidgetModel(objectModel):
    ......

I have some xml as input files, with a specific root tag name, like ( dataModel, layout, page) then I convert them to a object model. I have a map that determines which function should process the object model

xsdPathsMap = {
    "dataModel": createDataModelFromXml,
    "layout": createLayoutModel,
    "page": createWidgetModelFromXml
}

Then I create object models from xml and assign them the function that should process them,

result = xsdPathsMap[xmlRootName]
# a is objectified xml
a.modelerFunction = result

when I want to pass the object to its closure method I got this exception:

a.modelerFunction(a)

TypeError: object is not callable    

what is the problem?

and this is my Traceback :

Traceback (most recent call last):
  File "model/xmlTranporter.py", line 204, in <module>
    a = main("main/schema")
  File "model/xmlTranporter.py", line 200, in main
    a(obj)
TypeError: 'lxml.objectify.StringElement' object is not callable
  • 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-08T02:11:12+00:00Added an answer on June 8, 2026 at 2:11 am

    I’m not sure why you’re doing this assignment:

    result = xsdPathsMap[xmlRootName]
    a.modelerFunction = result # this is just kind of weird
    

    Either add the modeler functions to the class of a and just call it as a method:

    a.createModel()
    

    Or just pass a to the modeling function:

    result(a)
    

    However, this assumes that your modeling functions that you’re retrieving from the map are in fact functions and not classes.

    If you want to define classes that are callable that’s of course fine but you need to define the __call__ protocol method:

    class MyModelingFunction(object):
        ...
    
        def __call__(self, *args, **kwargs):
            """do something when I'm called"""
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some code in a couple of different functions that looks something like
PHP has some great functions (like array_walk) that allow you to process each element
I have some functions that use opengl to draw lines on the screen (health
I have a Base Router where i define some functions that need to be
I've been writing some jQuery functions that have JavaScript variables and looping, etc inside
I have some setup code in my functions.php file that sets permalinks and adds
I have a c# project that calls some functions from a c dll, the
I'm developing a XPCOM C++ component that have to use some RegExps functions Does
I have to create a wrapper DLL that exports some symbols (functions). Within its
I have a Python script that is using some closed-box Python functions (i.e. I

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.