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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T06:07:27+00:00 2026-05-30T06:07:27+00:00

I’ve been investigating this problem for 3 days now, without any luck. I’m quite

  • 0

I’ve been investigating this problem for 3 days now, without any luck. I’m quite new to all this so maybe there is something I’m missing.

The problem applies to: Maya.cmds, PyMel and evaluated MEL using QThread or just Thread

This code is designed to run on the “mayapy” python interpreter which follows Maya. I’ve created a short example which re-creates the same error in multiple instances.

One button works, the other one doesn’t. But they run the same code.

from PyQt4 import Qt

class doStuff( Qt.QThread ):
    taskProgress = Qt.pyqtSignal(int)

    # --------------------------------------------------------- #
    # Here things start to crash...
    def run( self ):

        # This works
        persp = mel.general.PyNode('persp')
        print persp.translateX.get()

        # This dont work
        poiLights = mel.general.ls( exactType="pointLight" ) 
        for light in poiLights:
            print light

        # This dont work
        geo = mel.general.PyNode('pPyramidShape1')
        print mel.modeling.polyEvaluate( geo, face=True )

        # Emit progress
        self.taskProgress.emit( 1 )

        return
    # END
    # --------------------------------------------------------- #

class ui( Qt.QWidget ):
    def __init__(self, parent=None):
        super(ui, self).__init__(parent)

        # Init QThread
        self.thread = doStuff()

        # Create Widgets
        buttonNo = Qt.QPushButton("Start - Dont work")
        buttonYes = Qt.QPushButton("Start - Works")

        # Setup Layout
        layout = Qt.QVBoxLayout()
        layout.addWidget( buttonYes )
        layout.addWidget( buttonNo )
        self.setLayout( layout )
        self.show()

        # --------------------------------
        # PROBLEM AREA: Button signals

        # This one dont work, but starts the thread correctly.
        self.connect( buttonNo, Qt.SIGNAL("clicked()"), self.thread.start )

        # This one works, but dont start the thread correctly.
        self.connect( buttonYes, Qt.SIGNAL("clicked()"), self.thread.run ) 

        # --------------------------------

        self.thread.taskProgress.connect( self.updateProgress )

        return

    # Feedback progress status
    def updateProgress( self, value ):
        print 'Current progress is:', value

        return

if __name__ == '__main__':

    import sys
    app = Qt.QApplication(sys.path)
    program = ui()

    # init maya
    import pymel.core as mel
    filePath = '/Users/ecker/Dropbox/Scripts/RibExporter/mayaScene3ani.ma'
    mel.openFile( filePath, f=True, o=True )

    sys.exit(app.exec_())

This code creates 2 buttons which start executing the same function when pressed. One executes thread.start and thread.run.

thread.start will make the thread work as it should, being able to feed back data to the Qt interface (for a progress bar), but most of the Maya code will start to return all kinds of errors like this:

Traceback (most recent call last):
  File "/Users/ecker/Dropbox/Scripts/RibExporter/error_recreation2.py", line 22, in run
    poiLights = mel.general.ls( exactType="pointLight" ) 
  File "/Applications/Autodesk/maya2012/Maya.app/Contents/Frameworks/Python.framework/Versions/Current/lib/python2.6/site-packages/pymel/core/general.py", line 969, in ls
    res = _util.listForNone(cmds.ls(*args, **kwargs))
  File "/Applications/Autodesk/maya2012/Maya.app/Contents/Frameworks/Python.framework/Versions/Current/lib/python2.6/site-packages/pymel/internal/pmcmds.py", line 134, in wrappedCmd
    res = new_cmd(*new_args, **new_kwargs)
TypeError: Flag 'long' must be passed a boolean argument

It is a boolean argument, and no matter what arguments I try to give it in what format and ways, it will always give errors very similar to this. At the same line res = new_cmd(*new_args, **new_kwargs) needing a boolean.

I need the thread to start, not just run. Unless there is a different way to do the threading, a workaround?

  • 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-30T06:07:28+00:00Added an answer on May 30, 2026 at 6:07 am

    Maya does not work well with threads. The key here is to use maya.utils.executeInMainThreadWithResult.

    http://download.autodesk.com/us/maya/2010help/index.html?url=Python_Python_and_threading.htm,topicNumber=d0e182779

    I hope this helps.

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a jquery bug and I've been looking for hours now, I can't
this is what i have right now Drawing an RSS feed into the php,
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I have this code to decode numeric html entities to the UTF8 equivalent character.
I want use html5's new tag to play a wav file (currently only supported
I am currently running into a problem where an element is coming back from
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString

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.