She was the Socialist Party 's candidate for the 2007 French presidential election but lost to Nicolas Sarkozy . The first woman in France to be nominated by a major party , she was the Socialist candidate in the 2007 French presidential election but lost to Nicolas Sarkozy on 6 May 2007 .