[Maya/Bug] // Error: line 1: Object's window not found. // when editing shelves

Hi All (its been a while :D: )

I’ve wanted to post about this for a while but other things kept coming up that were more important…

The problem:

I’ve got a script that edits a shelf icon when an event occurs. This works fine, however occasionally it would cause the script editor to print the "Objects Window not found: line 1 " error … but the icon was still edited and all seems well.

I haven’t really had time to dig further into this bug until recently and I’ve finally got a controlled reproduction for the issue. My impression is somethings failing inside of Maya as with the code inside a try statement, it fails to hit any exceptions. With echo all commands enabled on this is the output of the script editor just prior to the error.


string $parentPopupMenu = `popupMenu`;popupMenu -e -pmo 1 -pmc ( "shelfButtonPMO \"" + $parentPopupMenu + "\" 1 " + "\"MayaWindow|toolBar2|MainShelfLayout|formLayout14|ShelfLayout|MyTestShelf|shelfButton514\" \"/*dSBRMBMI*/\"" ) $parentPopupMenu;
// Error: line 1: Object's window not found. // 

Replication steps:

To rule out our tech, i managed to make the error occur on a virgin Maya (2013) installation by doing this.

[INDENT]

  1. Run this snippet ( I’m using the Help button as an example )

import pymel.core as pm
import maya.mel
gShelfTopLevel = maya.mel.eval('$tmpVar=$gShelfTopLevel') # Get a list of current tab names currently loaded in Maya
currentShelfTabs = pm.shelfTabLayout(gShelfTopLevel, query=True, childArray=True)
for tab in currentShelfTabs:
	if "General" in tab:
		shelfContents = pm.shelfLayout((gShelfTopLevel+"|"+tab), query=True, childArray=True)
		if shelfContents != None:
			for item in shelfContents:
				mItem = pm.uitypes.PyUI(item)
				if mItem.getLabel() == "Help":
					mItem.setEnable(False)

  1. So that shouldn’t have errored. Now, open the main Maya preferences window and either close the dialog (“x”) or hit save. Hitting cancel will not cause this issue to occur.

  2. Re-run the block of code above - you should now see the objects window error.

[/INDENT]

There are other ways you can cause the bug to occur other than opening / closing preferences - but that’s the simplest reproduction I’ve found so far.

As far as i know this is a completely benign error, but the little flash of red is annoying and it confuses some the users here as they think its something more important than it is, so any thoughts / advice would be very welcome!

Cheers!

~ Joe :wink:

The python versions should be giving a better line number in the error message. Which line does it complain on? Or is that error coming from a Maya directly?

I’m under the impression that the errors coming from Maya itself ( as exceptions not hit when in a try statement & the action is still performed )

Can you run the reproduction steps I’ve posted and see if you get the same behavior? :slight_smile:

I did as you instructed above in my install of Maya 2013 (64bit, SP2) and it didn’t produce any errors. Perhaps it’s been fixed?

Okay that’s reassuring.

Just grabbing SP2 myself ( how i hadn’t updated i have no idea… :?: )

Will update with feedback once i re-test!

Thanks :slight_smile:

Nope - still have the issue occuring - however on my SP2 machine, the bug also occurs if you click “cancel” on the preferences window… which rules out anything that happens when preferences / shelves get saved.

I shall continue my investigations. [ Btw this is one my rainy day bugs - so not exactly desperate to solve it ]

=)