return osa.communicate(ascript)[0]

def asConv(astr):
    astr = astr.replace('"', '" & quote & "')
return '"{}"'.format(astr)

def aScript(aspath):
    ascript = """
    set posixPath to POSIX path of {0}
    """.format(asConv
        (aspath))
Преобразовать путь Mac в posix в python