No, it's telling you that the key "Info" does not exist in the self.widgets
dictionary. cmds.textField calls, like any function call, is valid within
an else clause

Hope this points you in the right direction.

-Svenni

On Mon, Aug 20, 2012 at 9:08 AM, Florian Croquet <[email protected]> wrote:

> Hello, today another problem ^^
>
> I encounter a problem with a "else:" and a cmds.textField
>
> I just write this simple code :
>
> pathForText = projectPathPreview + "Comments/" +selectedCharacterPreview +
> ".txt"
>
> if os.path.exists(pathForText):
>         self.commentPreview(pathForText)
> else:
>       print "NOPE"
>       cmds.textField(self.widgets["Info"],edit =True,text= "No comments")
>
> commentPreview execute a command :
>             cmds.textField(self.widgets["Info"],edit =True,text= "Comments
> bla bla bla")
>
> the if statement is working correctly and my function display the right
> message in my textField
> Print "Nope" is also working
>
> But cmds.textField(self.widgets["Info"],edit =True,text= "No comments")
> return me an error "# Error: KeyError: file /code.py line 550: Info
>
> Is it possible that the cmds,textFields can not be performed inside an
> else statement ?
>
>
>  --
> view archives: http://groups.google.com/group/python_inside_maya
> change your subscription settings:
> http://groups.google.com/group/python_inside_maya/subscribe
>

-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe

Reply via email to