\[ \int \frac {4 x-x^2+e^x \left (-4 x+x^2\right )+e^{e^x} \left (-x^2+e^{2 x} \left (-4 x+x^2\right )+e^x \left (x+4 x^2-x^3\right )\right )+\left (-2 e^x+2 x\right ) \log \left (\frac {x}{5}\right )+\left (e^x x-x^2\right ) \log \left (-e^x+x\right )}{e^x x-x^2} \, dx \]
Optimal antiderivative \[ \left (-4+x \right ) \left ({\mathrm e}^{{\mathrm e}^{x}}+\ln \! \left (x -{\mathrm e}^{x}\right )\right )-\ln \! \left (\frac {x}{5}\right )^{2} \]
command
integrate(((exp(x)*x-x**2)*ln(x-exp(x))+((x**2-4*x)*exp(x)**2+(-x**3+4*x**2+x)*exp(x)-x**2)*exp(exp(x))+(-2*exp(x)+2*x)*ln(1/5*x)+(x**2-4*x)*exp(x)-x**2+4*x)/(exp(x)*x-x**2),x)
Sympy 1.10.1 under Python 3.10.4 output
\[ \text {Exception raised: TypeError} \]
Sympy 1.8 under Python 3.8.8 output
\[ x \log {\left (x - e^{x} \right )} + \left (x - 4\right ) e^{e^{x}} - \log {\left (\frac {x}{5} \right )}^{2} - 4 \log {\left (- x + e^{x} \right )} \]