Answer
The integral was evaluated as if the integrand is continuous on the interval.
It is not, so the integral is improper, and diverges.
Using a CAS, the result is "?" (undefined).
Work Step by Step
$\displaystyle \int_{0}^{\pi}\sec xdx$ is an improper integral, because $\sec x$ is undefined at $x=\displaystyle \frac{\pi}{2}\in[0,\pi].$
From the Definition of Improper Integrals with Infinite Discontinuities,
$\displaystyle \int_{a}^{b}f(x)dx=\int_{a}^{c}f(x)dx+\int_{c}^{b}f(x)dx$
$\displaystyle=\lim_{c\rightarrow b^{-}}\int_{a}^{c}f(x)dx+\lim_{c\rightarrow a^{+}}\int_{c}^{b}f(x)dx$.
$\displaystyle \int_{0}^{\pi}\sec xdx=\lim_{c\rightarrow(\pi/2)^{-}}\int_{-1}^{c}\sec xdx+\lim_{c\rightarrow(\pi/2)^{+}}\int_{c}^{\pi}\sec xdx$.
$=\displaystyle \lim_{c\rightarrow(\pi/2)^{-}}[\ln|\sec x+\tan x|]_{0}^{c}+\lim_{c\rightarrow(\pi/2)^{+}}[\ln|\sec x+\tan x]_{c}^{\pi}$
$=(\infty-\infty)...$
Indefinite form $\infty-\infty$,
the integral is undefined.
The integral was evaluated as if the integrand is continuous on the interval.
It is not, so the integral is improper, and diverges.
Using a CAS, the result is "?" (undefined).