It seems to me that the problem is the mathescape flag. Removing it worked for me, although according to minted documentation math is only rendered in comments. Could this be a bug in minted?
–
guillemApr 12 '12 at 6:40

1

I notice that your version of minted is in the current directory. You may have a version mismatch: which version of minted are you using? (The example is Works For Me using an up to date TeX Live 2011 and Pygments.)
–
Joseph Wright♦Apr 12 '12 at 8:02

minted simply dispatches the handling of mathescape. This bug is either in Pygments (either in the lexer or the formatter) or in fancyvrb. I’ve just had a look at the relevant parts in the source code of Pygments and I’m unable to find an obvious bug. The $is properly escaped, and should be unable to trigger math mode.
–
Konrad RudolphApr 12 '12 at 9:11

That said, what version of Pygments are you using? If I remember correctly, earlier versions of Pygments had this bug.
–
Konrad RudolphApr 12 '12 at 9:12

1

@Daniel The current version appears to be 1.5. You can install it using pip or easy_install.
–
Konrad RudolphApr 12 '12 at 12:07