I am writing a code to open a webpage and interact with it. I am using the mechanize module in pydev. The code so far I have written:
from bs4 import BeautifulSoup
from mechanize import Browser
from mechanize import HTTPError
import re
def main():
    movie='The Incredibles';
    movie_search='+'.join(movie.split());
    base_url= 'http://www.imdb.com/find?q=';
    final_url=base_url+movie_search+'&s=all';
    br=Browser();
    br.open(final_url);
    link=br.find_link(url_regex=re.compile(r'/title/tt.*'));
    dest=br.follow_link(link);
    print(link);
if __name__=="__main__":main()
When compiling I am getting the following error:
Traceback (most recent call last):
  File "D:\python\foldersorter\src\search.py", line 7, in <module>
    from mechanize import Browser
  File "C:\Python34\lib\site-packages\mechanize\__init__.py", line 122, in <module>
    from _mechanize import \
  File "C:\Python34\Lib\site-packages\mechanize\_mechanize.py", line 231
    except urllib2.HTTPError, error:
                            ^
SyntaxError: invalid syntax
What exactly is the syntax error I am unable to find out. I am working in python 3.4. Am I doing something wrong here?
 
    