[Python-Dev] os.path.normcase rationale?

Nir Soffer nirsof at gmail.com
Sun Oct 3 02:35:01 CEST 2010

On Sat, Sep 25, 2010 at 1:36 AM, James Y Knight <foom at fuhm.net> wrote:
> An OSX code sketch is available here (summary: call FSPathMakeRef to get an
> FSRef from a path string, then FSRefMakePath to make it back into a path,
> which will then have the correct case). And note that it only works if the
> file actually exists.
> http://stackoverflow.com/questions/370186/how-do-i-find-the-correct-case-of-a-filename
> It would indeed be useful to have that be available in Python.

There is a much simpler way:

>>> from Carbon import File
>>> File.FSRef('/tmp/foo').as_pathname()

Note that this is much slower compared to os.path.exists.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20101003/9c2faae1/attachment.html>

More information about the Python-Dev mailing list