I get an error in python3 when importing mechanize.
I\'ve just installed mechanize into my virtualenv where python3 is installed.
$ which python3
/Us
The module MechanicalSoup merged Mechanical and BeautifulSoup in the same Library and can be used since Python 2.6 through 3.4.
in command prompt install MechanicalSoup:
pip install MechanicalSoup
Then import in python,
import mechanicalsoup # Don’t forget to import the new module
I think you may have installed the Python 2 version of mechanize, and the new Python 3 import semantics are breaking the old Python 2 code. A quick search, and it seems like Python 3 support for mechanize is still a bit weak. However, I did find a Python 3 branch.
You could try manually installing from the source code I linked to. Once you've downloaded the source, change your directory so that you're in the mechanize directory. Then enter $python3 setup.py install
in the terminal.
Alas, mechanize doesn't support Python 3. http://wwwsearch.sourceforge.net/mechanize/faq.html
Python 2.4, 2.5, 2.6, or 2.7. Python 3 is not yet supported.
You might like to comment on the issue at https://github.com/jjlee/mechanize/issues/96
Update: I wrote my own automating library MechanicalSoup. It's Python 3 compatible https://github.com/hickford/MechanicalSoup