i've been messing around with maya on windows and i've noticed that there are some inconsistencies with path slashes that need to be resolved. maya returns forward slashes (/) on both windows and unix- like systems, but python tries to use back slashes (\) on windows. as a result, using os.path.join with paths returned by maya ends up producing mixed slashes:
>>> os.path.join( workspace(q=1, fullName=1), 'scenes' ) 'C:/path/to/project\scenes' i was wondering how people out there are dealing with this. it seems that maya and python can both understand paths with mixed slashes, but are there edge cases where this becomes a problem or where forward slashes do not work on windows? pymel provides the Path class, which overrides the / operator to mean os.path.join, which obviously has the same problem: >>> workspace.getcwd() / 'scenes' 'C:/path/to/project\scenes' however, i was considering making this operator smarter. options include: 1) always join with forward slash 2) choose the joining slash based on the left operand 3) join, then normalize resulting path to forward slash 4) join, then normalize resulting path using slash determined from left operand which of these seem like the best measure? is there any option i'm leaving out? -chad --~--~---------~--~----~------------~-------~--~----~ http://groups.google.com/group/python_inside_maya -~----------~----~----~----~------~----~------~--~---
