Search code examples
pythonpython-2.7mechanizemechanize-python

How do I close a mechanize browser?


I'm running into an error in mechanize for python in which valid links that I try to open with it gives me the following error:

urlopen error [Errno 8] nodename nor servname provided, or not known

And it's not a problem of mechanize not being able to open them because when I open them in interactive Python using mechanize, there is no error. So I'm suspecting that there is something wrong with too many mechanize browsers being open.

How would I close a mechanize browser?

Is there a command like br.close()?

TIA


Solution

  • As you said, there is a close() method on a Browser instance:

    br.close()