That python pastebin is awesome! Never seen that before (My day is complete, I learned something new ;) ) Hearing that the code works for you makes me feel a little better, I thought I was losing my mind.
The error I am getting is: <function dirPath at 0x0A83BFB0> "C:/Documents and Settings/ HP_Administrator/My Documents" "directory"; # Error: <function dirPath at 0x0A83BFB0> "C:/Documents and Settings/ HP_Administrator/My Documents" "directory"; # # Error: Syntax error # In this case I choose "My Documents" as the directory. I am using Maya 8.5. Thanks Jared On Oct 22, 2:29 pm, "Paul Molodowitch" <[EMAIL PROTECTED]> wrote: > Odd, your code worked perfectly for me... or at least it did once I > removed the line breaks which were (I assume) introduced in the email > formatting. > > Ie, this ran just fine for me: > > http://pastebin.com/f1369e0f2 > > Perhaps you could give the exact syntax error? > > - Paul > > On Wed, Oct 22, 2008 at 11:07 AM, jamsession <[EMAIL PROTECTED]> wrote: > > > I am trying to get the (user chosen) directory path from a browse > > function, but I keep getting a syntax error. This technique works > > perfectly in MEL but throws a syntax error in python. Is this a bug, > > or is there a better way of doing this in python > > > Thanks > > Jared > > > [code] > > > import maya.cmds as cmds > > win = "myWindow" > > def dirPath(filePath, fileType): > > cmds.textFieldButtonGrp('Dir', edit=True, text=str(filePath)) > > return 1 > > def gui(): > > #Creates the window. > > if(cmds.window(win, q=1, ex=1)): > > cmds.deleteUI(win) > > if(cmds.windowPref(win, q=1, ex=1)): > > cmds.windowPref(win, r=1) > > > cmds.window(win, t="Test Window", w=350, h=150) > > cmds.columnLayout("colLyt") > > cmds.textFieldButtonGrp('Dir',label='Directory Path', text='Browse > > for Directory', buttonLabel='browse', buttonCommand=browseIt) > > cmds.showWindow(win) > > def browseIt(): > > cmds.fileBrowserDialog( m=4, fc=dirPath, ft='directory', > > an='Choose Directory') > > return > > gui() > > > [/code] --~--~---------~--~----~------------~-------~--~----~ Yours, Maya-Python Club Team. -~----------~----~----~----~------~----~------~--~---
