To use tor with mechanize, I use tor + polipo. set polipo use the parent proxy socksParentProxy = localhost: 9050 in the conf file. then use
browser.set_proxies ({"http": "localhost: 8118"})
where 8118 is your polypo port.
so you use polipo http proxy which uses sock to use tor
hope this helps :)
source
share