{"action":"closed","issue":{"url":"https://api.github.com/repos/LumaPictures/pymel/issues/320","labels_url":"https://api.github.com/repos/LumaPictures/pymel/issues/320/labels{/name}","comments_url":"https://api.github.com/repos/LumaPictures/pymel/issues/320/comments","events_url":"https://api.github.com/repos/LumaPictures/pymel/issues/320/events","html_url":"https://github.com/LumaPictures/pymel/issues/320","id":105642854,"number":320,"title":"Creating object with name clash to another object not in top level throws MayaNodeError","user":{"login":"elrond79","id":71800,"avatar_url":"https://avatars.githubusercontent.com/u/71800?v=3","gravatar_id":"","url":"https://api.github.com/users/elrond79","html_url":"https://github.com/elrond79","followers_url":"https://api.github.com/users/elrond79/followers","following_url":"https://api.github.com/users/elrond79/following{/other_user}","gists_url":"https://api.github.com/users/elrond79/gists{/gist_id}","starred_url":"https://api.github.com/users/elrond79/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elrond79/subscriptions","organizations_url":"https://api.github.com/users/elrond79/orgs","repos_url":"https://api.github.com/users/elrond79/repos","events_url":"https://api.github.com/users/elrond79/events{/privacy}","received_events_url":"https://api.github.com/users/elrond79/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/LumaPictures/pymel/labels/imported","name":"imported","color":"FFFFFF"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-09-09T17:11:40Z","updated_at":"2015-12-08T19:44:54Z","closed_at":"2015-12-08T19:44:54Z","body":"_From [anthony....@greenworm.net](https://code.google.com/u/103976330729870737779/) on October 06, 2012 04:53:23_\n\nDescribe the problem. -- If you attempt to create a new object (e.g. a locator) with an explicit name set and another object with the same name exists outside of the top level (e.g. in a group) the node requested will be created and the name the name will be set to the same as the existing node prepended with a |, but you'll also have a MayaNodeError thrown What Version of Maya are you using? -- Maya 2012\r\n\r\nOn what operating system? (be as specific as possible and include service packs, 64bit vs 32bit, etc)\r\n-- Win 7 SP1 x64 What Version of PyMEL are you using? -- 1.0.3 What is the expected output? What do you see instead? -- Ideally, I'd like to have the exception not thrown, and the name selection to match what I'd get if i used the rename function (i.e. if there's a clash, it'll return a name suffixed with a number that's one higher than any other object in the scene with the same base number)\r\n\r\nIf possible, provide a few lines of code to reproduce the problem. It helps us if your code will reproduce the problem from a new scene.\r\n\r\n\\# setup and cleanup\r\nimport pymel.core as pm\r\nimport traceback\r\npm.newFile(force=True)\r\npm.flushUndo()\r\n\r\n\\# begin reproduction:\r\nlocatorList = list()\r\n\\# create ten locators called 'theLocator[1:10]'\r\nfor x in range(10):\r\n    locatorList.append(pm.spaceLocator(name=\"theLocator1\"))\r\n\r\n\\# group objects to move them into a non-root level\r\npm.group(locatorList)\r\n\r\n\\# try create a new locator, \"theLocator5\"\r\n\\# throws a MayaNodeError, but creates the node anyway.\r\n\\# run this block again, and you'll find a locator created with a name of theLocator11\r\ntry:\r\n    \\# just to prove it's not specific to the 'first' number\r\n    theLocator = pm.spaceLocator(name=\"theLocator5\") \r\nexcept:\r\n    traceback.print_exc()\r\n\r\n\\# Traceback (most recent call last):\r\n\\#   File \"<maya console>\", line 21, in \\<module>\r\n\\#   File \"C:\\Program Files\\Autodesk\\Maya2012\\Python\\lib\\site-packages\\pymel\\internal\\factories.py\", line 883, in newFuncWithReturnFunc\r\n\\#     res = returnFunc(res[0])\r\n\\#   File \"C:\\Program Files\\Autodesk\\Maya2012\\Python\\lib\\site-packages\\pymel\\core\\general.py\", line 1679, in __new__\r\n\\#     raise _objectError( name )\r\n\\# MayaNodeError: Maya Node does not exist: u'theLocator5' Does maya.cmds exhibit the same problem? -- No. Maya.cmds will not throw an exception but the node created will still be named with the duplicate name, and subsequent calls will also increment from the top. Please provide any additional information below. --No idea if it helps, but just poking around a little further, if I catch the exception and check what theLocator is, it's surprisngly (to me) theLocator11. \r\n--Again, no idea, but is this related to issues 225 and 221?\n\n_Original issue: http://code.google.com/p/pymel/issues/detail?id=286_"}}