Hi. I'm not at my computer to check your script but I think I recall insuring 
that namespaces were empty by using the:

cmds.namespace(mv=(namespace_to_empty, ':') # puts contents into default / 
scene namespace. 

before deleting. May be unrelated to your issue. If so, just ignore.. :)

Gerard. 

> On 4 May 2015, at 7:33 pm, yann19 <[email protected]> wrote:
> 
> Hi all, I am trying to do some namespace removal in the python way but I am 
> meeting with some problems, especially those nested namespaces.
> 
> This is my code:
> 
> nsLs = cmds.namespaceInfo( lon=True )
> defaultNs = ["UI", "shared", "camera01"]    # I need camera01
> 
> diff = [item for item in sel if item not in defaultNs]
> 
> for ns in diff:
>     if cmds.namespace( exists=str(ns)):
>         cmds.namespace(rm=str(ns))
> 
> I am having issues with deleting "new_run01" that resides within "v02" and 
> "v03", as soon as I run the code, I am getting this error:
> # Error: line 1: The namespace 'v02' is not empty.
> # Traceback (most recent call last):
> #   File "<maya console>", line 8, in <module>
> # RuntimeError: The namespace 'v02' is not empty. # 
> 
> I have checked and verified that there is no contents listed within those 2 
> new_run01 but unless I opened up the Namespace Editor and delete them 
> manually, it seems to defeat the purpose of scripting it in the first place.
> 
> Was wondering if anyone happen to do something similar before? Many thanks in 
> advance!
> 
> 
> 
> 
> 
> 
> -- 
> 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/00412c30-471d-4ba5-bb35-13cf7657c5e6%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
Gerard. 

> On 4 May 2015, at 8:21 pm, yann19 <[email protected]> wrote:
> 
> There was a typo in code.. It should be:
> 
> nsLs = cmds.namespaceInfo( lon=True )
> defaultNs = ["UI", "shared", "camera01"]    # I need camera01
> 
> diff = [item for item in nsLs if item not in defaultNs]
> 
> for ns in diff:
>     if cmds.namespace( exists=str(ns)):
>         cmds.namespace(rm=str(ns))
> 
> -- 
> 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/80fd0be8-c9b8-4500-b4db-76540d8774b2%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
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/8F84D7CD-59DF-42C8-8720-1F34DB369A3A%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to