Getting argument error

14 views
Skip to first unread message

likage

unread,
Nov 10, 2014, 11:54:12 PM11/10/14
to python_in...@googlegroups.com
I am trying to do a short simple exporting ui in which as user will select the exporting directory, then an option from the combobox (else it will only be showing Option 01 in the combobox), lastly clicking onto the Export Button

However, I am getting this error # TypeError: exportFunc() takes exactly 3 arguments (1 given) even though I did fulfill the number of required arguments

It is working well before I modify this current code of mine

def initUI(self):
   
...
   
self.exportCombo = QComboBox()
   
self.exportCombo.addItem('Option 01')
   
self.exportCombo.addItem('Option 02')

def createConnections(self):
   
...
   
self.connect(self.exportFuncBtn, SIGNAL('clicked()'), self.exportFunc)
   
self.connect(self.exportCombo, SIGNAL('currentIndexChanged(const QString &)'), self.comboSel )
   

def exportFunc(self, minTime, maxTime):
   
# Function that denotes the exporting on the button
   
...
   
def comboSel(self, current):
    selection
= cmds.ls(sl=True)
   
   
if str(current) == 'Option 01':
        minTime
= cmds.playbackOptions(query=True, minTime=True)
        maxTime
= cmds.playbackOptions(query=True, maxTime=True)

   
else:
        minTime
= cmds.findKeyframe(selection, which='first')
        maxTime
= cmds.findKeyframe(selection, which='last')
       
   
self.exportFunc(minTime, maxTime)


Justin Israel

unread,
Nov 11, 2014, 12:24:04 AM11/11/14
to python_in...@googlegroups.com
Hi,

This line is the culprit:

def createConnections(self):
    
...
    
self.connect(self.exportFuncBtn, SIGNAL('clicked()'), self.exportFunc)

You are connecting your exportFunc to the clicked signal, which emits no arguments, yet your method requires 2. 

- Justin


--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/7a2762bf-c827-4a33-bf6e-10b9aa5b5dc1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

likage

unread,
Nov 11, 2014, 3:07:09 AM11/11/14
to python_in...@googlegroups.com
Hi Justin, thanks for pointing out my mistake.

I messed up my signals, as a matter of fact, I am connecting to the wrong function but I managed to get it sorted out.

Thanks again!
Reply all
Reply to author
Forward
0 new messages