def relative_symlink(source_path, link_path):
 if (not os.path.isabs(source_path)):
  raise ValueError(u'Path for source:{} must be absolute'.format(source_path))
 if (not os.path.isabs(link_path)):
  raise ValueError(u'Path for link:{} must be absolute'.format(link_path))
 if (source_path == link_path):
  raise ValueError(u'Path for link is identical to source:{}'.format(source_path))
 if (os.path.isdir(link_path) and (not os.path.islink(link_path))):
  raise ValueError(u'Path for link would overwrite an existing directory: {}'.format(link_path))
 try:
  if os.path.lexists(link_path):
   os.unlink(link_path)
  rel_path = os.path.relpath(source_path, os.path.dirname(link_path))
  os.symlink(rel_path, link_path)
 except OSError as e:
  if (not ((e.errno == errno.EEXIST) or (e.errno == errno.ENOENT))):
   raise

def relative_symlink ( source_path , link_path ) : if ( not os . path . isabs ( source_path ) ) : raise ValueError ( u'Path for source:{} must be absolute' . format ( source_path ) ) if ( not os . path . isabs ( link_path ) ) : raise ValueError ( u'Path for link:{} must be absolute' . format ( link_path ) ) if ( source_path == link_path ) : raise ValueError ( u'Path for link is identical to source:{}' . format ( source_path ) ) if ( os . path . isdir ( link_path ) and ( not os . path . islink ( link_path ) ) ) : raise ValueError ( u'Path for link would overwrite an existing directory: {}' . format ( link_path ) ) try : if os . path . lexists ( link_path ) : os . unlink ( link_path ) rel_path = os . path . relpath ( source_path , os . path . dirname ( link_path ) ) os . symlink ( rel_path , link_path ) except OSError as e : if ( not ( ( e . errno == errno . EEXIST ) or ( e . errno == errno . ENOENT ) ) ) : raise
create a symlink at link_path pointing to relative source .