[Pythonmac-SIG] cross platform os.path.nornpath problem

Magladry, Stephen stephenm@humongous.com
Wed, 18 Sep 2002 11:53:17 -0700


we are working on a cross platform game and I am running into a "problem"
with os.path.normpath. We have decided to use Unix style relative paths
within our Python code. The system, written in c++,  is then responsible for
the conversion to a Mac specific path for file i/o. The problem is lies
within some Python code. Here is a quick example.


import os
print os.path.normpath( "foo/goo/file.txt" )# a unix relative path
(result) >>> :foo/goo/file.txt

Well, of course! "/" are valid chars in a Mac file name, so the operation
worked as intended. I would have liked to have the result be "file.txt". Is
there a way within Python 2.2.1 that I could do this with writing our own
special normalizer?


Thanks,


Stephen Magladry