Answer
$$ y=\frac{1}{(3/2)+\cos x} .$$
Work Step by Step
By separation of variables, we have
$$y^{-2}dy=\sin x dx $$
then by integration, we get
$$ -y^{-1}=-\cos x+c .$$
Now, since $y(\pi)=2$, then $c=-3/2$.
So the general solution is given by $$ y=\frac{1}{(3/2)+\cos x} .$$