import mechanize module to python script
Question: I tried to import mechanize module to my python script like this,

from mechanize import Browser

But, Google appengine throws HTTP 500 when accessing my script.

To make things more clear, Let me give you the snapshot of my package
structure,

    
    
    root
     ....mechanize(where all the mechanize related files there)
     ....main.py
     ....app.yaml
     ....image
     ....script
    

Can anyone help me out to resolve this issue?

Thanks, Ponmalar


Answer: The mechanize main page says:

> mechanize.Browser is a subclass of mechanize.UserAgentBase, which is, in
> turn, a subclass of urllib2.OpenerDirector

My understanding is that urllib2 is one of the sandboxed modules in GAE, with
its functionality being replaced by the Google-provided urlfetch. You'd need
to re-implement the mechanize.UserAgentBase class to use urlfetch, if that's
at all possible.

