I would like to know what has gone wrong in this 'proof'.
Suppose that $$k\frac 1\pi\pi=\frac ab\operatorname{,where}a,b\in \mathbb Z\operatorname {and}k\in \mathbb Q.$$ Then, we multiply both sides by $i$ and raise $e$ to the power of both sides. We find that $$e^{i(k\frac 1\pi)\pi}=e^{i\frac{2a}{2b}}$$ This implies that $$e^{i(2bk\frac 1\pi)\pi}=e^{i2a}.$$ Using laws of expontents, we rewrite this as $$\begin{pmatrix}e^{i2b\pi}\end{pmatrix}^{\frac k\pi}=e^{i2a}.$$ Since b is an integer, the left hand side is equal to $1$. We take the natural log of both sides using the definition of the natural log in the complex domain.Thus,$$0=i(2a+2n\pi)\operatorname{for some integer }n.$$ Since the imaginary part of $0$ is $0$, $$a+n\pi=0.$$ Rearranging the equation for $\pi,$ we find that $\pi=-\frac an$, which is a contradiction as $\pi$ is irrational.
This is very odd because $k\frac 1\pi=k$ and $k$ is assumed to be a rational number. I have no idea what I have proven despite trying being careful, particularly when using complex numbers. Could someone point out an error?
The main problem is that some of the rules for working with powers from real numbers are no longer true with complex numbers.
While for 2 complex number $z_1,z_2$ the rule $e^{z_1+z_2}=e^{z_1}e^{z_2}$ is still correct, the version dealing with multiplied exponents isn't, generally we have
$$e^{z_1z_2} \color{red}\neq \left(e^{z_1}\right)^{z_2}.$$
A simple example is $z_1=2\pi i, z_2=\frac12$, where the left hand side is $e^{\pi i}=-1$ while the right hand side is $1^{\frac12}=1$.
The reason why that is so is that even defining what the right hand side means is non-trivial in the general case. I refer you to the Wikipedia entry for Complex exponentiation for further information.
In your proof, where you go wrong is in rewriting $e^{i(2bk\frac1{\pi})\pi}$ as $\left(e^{i2b\pi}\right)^{\frac{k}\pi}$, because that is using exactly the above incorrect formula for multiplied exponents.
Note that you did a similar step before, when you went from
$$e^{i(k\frac 1\pi)\pi}=e^{i\frac{2a}{2b}}$$
to
$$e^{i(2bk\frac 1\pi)\pi}=e^{i2a}.$$
This is not incorrect, though I guess just "by accident". You muliplied both exponenets by the integer $2b$, which works, for any complex $z$ and any integer $n$ we have
$$e^{nz}=\left(e^z\right)^n$$
That's a consequence of $n$ being an integer and using the valid rule about adding exponents:
$$e^{nz}=e^{z+z+\ldots+z}=e^ze^z\ldots e^z=(e^z)^n,$$
if $n$ is positive and for negative integer $n$ it then follows from $e^{-z}=\frac1{e^z}$.
To summarize, dealing with complex exponentiation can be hard because internalized rules that were valid for real numbers no longer apply, or only in special cases. Any time you see a potentially non-real complex number raised to a non-integer power is cause for thinking really hard what that means in the given context. Same goes for a real number raised to a complex power.