Need to create a soft link to a file

M

Markus

Hello,

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.

How would I do this?

Thanks,
Mark
 
F

Fredrik Lundh

Markus said:
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:

symlink(...)
symlink(src, dst)

Create a symbolic link.

Hope this helps!

</F>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,045
Latest member
DRCM

Latest Threads

Top