Need to create a soft link to a file
Fredrik Lundh
fredrik at pythonware.com
Sun Sep 19 13:20:14 EDT 2004
"Markus" <m.a.r.k at gmx.de> wrote:
> I'm running on Mac OS X and need to create a soft link to a file.
>
> I tried both makealias() and link(). While makealias creates a Finder alias just fine my
> application that needs to read the reference file doesn't like this. link() produces 1) a hard
> link and b) gives me the following error: OSError: [Errno 45] Operation not supported
>
> I guess what I'm looking for is a way to call the Unix ln command from within my python program.
A plain "ln" uses link(), of course. Assuming you meant "symbolic link"
and "ln -s", and that Mac OS X works like other Unixes, the function
you're looking for is called os.symlink:
>>> help(os.symlink)
symlink(...)
symlink(src, dst)
Create a symbolic link.
Hope this helps!
</F>
More information about the Python-list
mailing list