With .\tmp.txt containing
>>> where_did_this_go = str('e_x e_y e_z')
the command
pygments -l pycon -f latex -O escapeinside=QQ .\tmp.txt
gives
\begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8}]
\PY{l+s+s1}{\PYZsq{}}\PY{l+s+s1}{e\PYZus{}x e\PYZus{}y e\PYZus{}z}\PY{l+s+s1}{\PYZsq{}}\PY{g+go}{)}
\end{Verbatim}
Q doesn't even appear anywhere in my input - so why is the output getting mangled?