(source, target)
Cross-platform symlink
Cross-platform symlink
Cross - platform symlink
def symlink(source, target):
    """Cross-platform symlink"""
    os_symlink = getattr(os, "symlink", None)
    if callable(os_symlink):
        os_symlink(source, target)
    else:
        import ctypes
        csl = ctypes.windll.kernel32.CreateSymbolicLinkW
        csl.argtypes = (ctypes.c_wchar_p, ctypes.c_wchar_p, ctypes.c_uint32)
        csl.restype = ctypes.c_ubyte
        flags = 1 if os.path.isdir(source) else 0
        if csl(target, source, flags) == 0:
            raise ctypes.WinError()
def symlink ( source , target ) : os_symlink = getattr ( os , "symlink" , None ) if callable ( os_symlink ) : os_symlink ( source , target ) else : import ctypes csl = ctypes . windll . kernel32 . CreateSymbolicLinkW csl . argtypes = ( ctypes . c_wchar_p , ctypes . c_wchar_p , ctypes . c_uint32 ) csl . restype = ctypes . c_ubyte flags = 1 if os . path . isdir ( source ) else 0 if csl ( target , source , flags ) == 0 : raise ctypes . WinError ( )