[Tutor] symlinking dirs with spaces

fomcl at yahoo.com fomcl at yahoo.com
Sat Apr 27 20:53:45 CEST 2013



--- On Friday, April 26, 2013 9:53 PM, eryksun <eryksun at gmail.com> wrote:

On Fri, Apr 26, 2013 at 8:10 AM, mike <mike at froward.org> wrote:
>
> def link():
>     print "Adding %s to %s..." % (origFul, loadDir)
>     os.symlink('origFul', 'media')

Your arguments for symlink() are string literals. How about this?

    LOAD_DIR = "/opt/data/music/load"

    def link(media):
        src = os.path.abspath(media)
        dst = os.path.join(LOAD_DIR, os.path.basename(media))
        print "Adding %s to %s..." % (src, LOAD_DIR)
        os.symlink(src, dst)

IIRC, os.symlink is not present in Python on Windows, right? (I'm on vacation now so I can't check this). But aren't soft links and shortcuts linux and windows terms for the same thing? 


More information about the Tutor mailing list