Try it without the backticks around cmds.textField.

SBpath = 'G:\\ProjectPath\\'
import maya.cmds as cmds 
import os, glob, time
    
def buttonLGTPressed(*args):
    EpisodeName = cmds.textField("Episode", query = True, text = True)
    print EpisodeName
    rootEp = SBpath + "{}\\".format(EpisodeName)
    print(rootEp) # EXPECTED: G:\ProjectPath\*\241\ # RESULT: 
G:\ProjectPath\u'241'\

window = cmds.window(title = "Open Last scene", width = 150, height = 100)
cmds.rowColumnLayout( numberOfColumns=2, columnAttach=(1, 'left', 0), 
columnWidth=[(1, 100), (2, 250)] )
cmds.textField( "Episode", text = "001")
cmds.button('OpenLGT', l="Open Last LGT scene", w=180, h=30, command=
buttonLGTPressed)
cmds.showWindow()


On Monday, April 17, 2017 at 8:29:59 AM UTC-5, gnn wrote:
>
> did someone know how to convert this result: u'001 in : 001
> To put it in a variable path: Z:\ProjectPath\001\
> By advance, thanks a lot for your help!! 
> <http://stackoverflow.com/questions/43449099/python-convert-u001-to-001-in>
>
> SBpath = 'G:\\ProjectPath\\'
> import maya.cmds as cmds 
> import os, glob, time
>     
> def buttonLGTPressed(*args):
>     EpisodeName = `cmds.textField("Episode", query = True, text = True)`
>     print EpisodeName
>     rootEp = SBpath + "{}\\".format(EpisodeName)
>     print(rootEp) # EXPECTED: G:\ProjectPath\*\241\ # RESULT: 
> G:\ProjectPath\u'241'\
>
> window = cmds.window(title = "Open Last scene", width = 150, height = 100)
> cmds.rowColumnLayout( numberOfColumns=2, columnAttach=(1, 'left', 0), 
> columnWidth=[(1, 100), (2, 250)] )
> cmds.textField( "Episode", text = "001")
> cmds.button('OpenLGT', l="Open Last LGT scene", w=180, h=30, command=
> buttonLGTPressed)
> cmds.showWindow()
>
>
>
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/652a378e-1f2b-416e-81ea-c740fb9bfdfa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to