def asExec(ascript):
    osa = subprocess.Popen(['osascript', '-'], stdin=subprocess.PIPE,
        stdout=subprocess.PIPE)
return osa.communicate(ascript)[0]

def asConv(astr):
    astr = astr.replace('"', '" & quote & "')
return '"{}"'.format(astr)
Convert mac path to posix in python