PDA

View Full Version : Python Help


Kris00
08-01-2008, 06:41 PM
Hey Guys, Im trying to have user search for a folder, select it, then the callback feeds that
folder path into the textField all in python

Im kinda new to python, can anyone tell me why it isnt working?

Code:

def filePathChangeDirM(directoryPathInput):
cmds.textField("dirTextInfo", edit = True, text = directoryPathInput)

def filePathCallback():
cmds.fileBrowserDialog( m = 4, fc = filePathChangeDirM, ft = "directory", an = "Location for Directory")

NaughtyNathan
08-04-2008, 09:28 AM
If you run it, Maya tells you what the error is:


# Error: filePathChangeDirM() takes exactly 1 argument (2 given)
# TypeError: filePathChangeDirM() takes exactly 1 argument (2 given) #

your proc "filePathChangeDirM" has been given two args, and you've only defined it to accept 1.. obviously the fileBrowserDialog command sends 2 args to the callback command.. which you should already know as I aleready gave you a working example in MEL! ;)

def filePathChangeDirM(directoryPathInput,fileType):


should fix it.

:nathaN

CGTalk Moderation
08-04-2008, 09:29 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.