[issue9333] Expose a way to enable os.symlink on Windows

Jason R. Coombs report at bugs.python.org
Fri Jul 23 00:18:41 CEST 2010


Jason R. Coombs <jaraco at jaraco.com> added the comment:

I think we should consider simply calling this function before running os.symlink. It would be nice if the API were as compatible as possible on both unix and Windows.

My worry is that where code that works on unix systems is simply:

    os.symlink(...)

But now to support symlinks on Windows, one must write:

    if hasattr(os, 'enable_symlink') and not os.enable_symlink():
        raise WindowsError(...)
    os.symlink(...)

Maybe instead of adding os.enable_symlink, Python should include the above logic before attempting to create a symlink and raise an exception if it fails? This would provide a consistent API across platforms for the most common use-case.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9333>
_______________________________________


More information about the Python-bugs-list mailing list