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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:31:25+00:00 2026-05-26T23:31:25+00:00

Following the question I had asked yesterday which is here passing contents from multiple

  • 0

Following the question I had asked yesterday which is here passing contents from multiple lists generated in different functions to a file I have written the code. Part of the code is below,

def lower_lip_under_upper_teeth_bezier(x_n, p0, p3) :
    """ Calculating sampling points using rational bezier curve equation"""
    lower_lip_under_upper_teeth_p_u_list = []
    u = x_n
    p1 = p0
    p2 = p3

    lower_lip_under_upper_teeth_p_u = math.pow(1 - u, 3) * p0 + 3 * u * math.pow(1 - u, 2) * p1 \
                                 + 3 * (1 - u) * math.pow(u, 2) * p2 + math.pow(u, 3) * p3
    lower_lip_under_upper_teeth_p_u = lower_lip_under_upper_teeth_p_u * w
    d = math.pow(1 - u, 3) * w + 3 * u * w * math.pow(1 - u, 2) + 3 * (1 - u) * w * math.pow(u, 2) + math.pow(u, 3) * w
    lower_lip_under_upper_teeth_p_u = lower_lip_under_upper_teeth_p_u / d

    print "p(u): ", lower_lip_under_upper_teeth_p_u
    lower_lip_under_upper_teeth_p_u_list.append(lower_lip_under_upper_teeth_p_u)

    return lower_lip_under_upper_teeth_p_u_list

def mel_script() :
  """ Generating the mel script with the animation information """
    print "\n The mel script generated for the input speech with the chosen energy level" 
    with open("mel.txt", "w") as melFile :
        melFile.write('setKeyframe "BS_stickyLips_SL_recept.head_geo_stickyLips_wire";'
                      'setKeyframe "BS_stickyLips_baseSL_recept.head_geo";'
                      'setKeyframe "BS_stickyLips_wireSL_recept.head_geo";'
                      'setKeyframe "blend_shape.lip_round";'
                      'setKeyframe "blend_shape.jaw_open";'
                      'setKeyframe "blend_shape.lips_spread";'
                      'setKeyframe "blend_shape.lips_part";'
                      'setKeyframe "blend_shape.lower_lip_under_upper_teeth";')

    for p in lower_lip_under_upper_teeth_bezier :
        melFile.write('setAttr "blend_shape.jaw_open" %f ;' % p )
        melFile.write('setKeyframe -breakdown 0 -hierarchy none -controlPoints 0 -shape 0 {"blend_shape"};')

But I am getting an error which is,

    for p in lower_lip_under_upper_teeth_bezier :
TypeError: 'function' object is not iterable
  • 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-05-26T23:31:26+00:00Added an answer on May 26, 2026 at 11:31 pm

    lower_lip_under_upper_teeth_bezier is a function. The error message clearly tells it, there is no way around it.

    You might believe that lower_lip_under_upper_teeth_bezier is an iterable, but it is not.

    Now, mine is just a guess, but I believe what you want to do is something like:

    def mel_script(lip_var):
        '''The mel script generated for the input speech with the chosen energy level'''
        with open("mel.txt", "w") as melFile :
            melFile.write('setKeyframe "BS_stickyLips_SL_recept.head_geo_stickyLips_wire";'
                          'setKeyframe "BS_stickyLips_baseSL_recept.head_geo";'
                          'setKeyframe "BS_stickyLips_wireSL_recept.head_geo";'
                          'setKeyframe "blend_shape.lip_round";'
                          'setKeyframe "blend_shape.jaw_open";'
                          'setKeyframe "blend_shape.lips_spread";'
                          'setKeyframe "blend_shape.lips_part";'
                          'setKeyframe "blend_shape.lower_lip_under_upper_teeth";')
        for p in lip_var:    # Check this out!!!
            melFile.write('setAttr "blend_shape.jaw_open" %f ;' % p )
    

    EDIT (see comments): I think there is some basic misunderstanding on how python works going on here… In python (as in most programming languages!) when you declare a function, you declare its name and what arguments it expects.

    If you are trying to pass 5 lists to mel_script, when you declare mel_script you should say so:

    def mel_script(list1, list2, list3, list4, list5):
        # Your code here should work with list1, list2, etc...
    

    Then, when calling mel_script, you need to pass these lists to it. If such lists are generated by functions (say f1, f2, f3…). You could do it all in one line with:

    mel_script(f1(), f2(), f3(), f4(), f5())
    

    otherwise you have to store the lists in temporary variables and pass those to mel_scirpt:

    tmp1 = f1()
    tmp2 = f2()
    tmp3 = f3()
    tmp4 = f4()
    tmp5 = f5()
    mel_script(tmp1, tmp2, tmp3, tmp4, tmp5)
    

    In the above examples note that f1() has round parenthesis denoting the fact you are calling the function named f1. If you would omit those, then you would be passing the function itself, not its result.

    In reality there are cleverer ways to achieve this (like passing a variable number of arguments, or using closures, but from your question I understand that you are not (yet!) proficient with python, so it would be better to stick with this method for now! 🙂

    HTH!

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

Sidebar

Related Questions

extending the question I had asked earlier which can be found here, plotting multiple
Following on from a previous question I had here : Copying a string from
I had a question answered which raised another one, why following does not work?
yesterday I just asked following question. How to customize tableView Section View - iPhone
I recently asked a question (and had it answered) here: jQuery Load JSON I
The following question is related to a question that I had asked earlier: Help
Following yesterday's question, I did some research and I thought I had a more
This question is overflow from the following question: How do I programmatically convert mp3
This question comes from my experience with the following question: https://stackoverflow.com/questions/492748/new-responses-icon-on-so-crashes-ie7-closed In that question,
I have gone through following question. Convert NSString to NSDictionary It is something different

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.