Thanks for enlightenment Joe, I know that there are some limitation with os
module, that is why I said "more" error-proof and not "absolutely" error
proof.

Most of the time I would use:

>>> os.path.join("c", "Desktop", "Users", "jo", "mydatas")
'c\\Desktop\\Users\\jo\\mydatas'

As far as possible I avoid using seps , what is the point of using os if
you want harcoded abs paths. For that you can simply do a string
concatenation. Also if you let your paths be decided procdurally, you would
not end up having to write the sep yourself. Like in the example I write
fileName = os.path.basename(filePath)

then I do not care what separator is in fileName and it works perfectly (if
I may) with

oSource.Filename.value = os.path.join("Pictures", fileName)

so in this case the code I wrote should work on os, win and linux.


For the point in case softimage's BuildPath method can also be used.

But again, nothing is perfect and I always follow
"the-perfect-code-is-the-code-that-works" policy ! ;)

Reply via email to