Python builtins overwritten in Maya using Wing

I have an odd issue while using Wing to debug in maya. So I am using pymongo to do some metrics tracking. The process of the problem is this:

[ol]
[li]Set breakpoint in wing[/li][li]Hit break point[/li][li]poke around[/li][li]continue[/li][li]Trigger the metrics function that stores an object to mongo[/li][li]the codecs module is set to None[/li][/ol]

At this point BSON freaks out and everything fails and i need to restart maya. If I never break, then all is well. The problem is in Maya/bin/python26.zip/encodings/utf_8.py. I i track it down there, it shows that the builtin codecs module has been set to None and thus cannot decode the string.

I’m not sure if this is wing specific or not, I figured I would throw it out here just in case.

Has anyone seen anything like this before?

Does Wing use the Pydev debugger? I know certain programs can behave unstably under the debugger, Maya would be one such program. If Wing’s debugger is it’s own, it’s even less likely to be stable.
Anyway, what do you mean by ‘builtin’ codecs? You mean the stdlib codecs module?
Can you check sys.modules[‘codecs’] before and after your metrics? Is sys.modules[‘codecs’] None, or is it only in the utf_8 module?
I suppose you could create a custom dict type and assign it to sys.modules so you can better monitor what’s going on (just behave the same as dict but give you an option to set a breakpoint)?

Sorry, yes the stdlib codecs module from C:\Program Files\Autodesk\Maya2013.5\bin\python26.zip.

Debugging is weird, if i break at the codecs.decode call and check codecs it is None. If i import the module in the debug probe then its set correctly, but it still fails. Also, if i check sys.modules[‘codecs’] before i do anything, it reports as being set properly. I printed sys.modules[‘codecs’] just before the call in the pymongo scripts and it reports fine.

So I have no idea how, when, or why its being set to None. I’ve removed the debugger from the equation completely and it’s still occurring.