title: Python mechanize - no control matching
body: <p>I am trying to write a script which read a list o domains from a file and check if a domain is a WordPress site.</p>
  
  <p>I got some errors when I am trying to use the mechanize library about form controls, and after searching the web I was not able to locate any similar solution. </p>
  
  <p>The used code if as follow: </p>
  
  <pre><code>br = mechanize.Browser()
  br.set_handle_robots(False)
  br.addheaders = [("User-agent","Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.13) Gecko/20101206 Ubuntu/10.10 (maverick) Firefox/3.6.13")] 
  base_url = br.open("http://www.isitwp.com/")
  
  
  with open('domains') as f:
      for line in f:
          rowdict['website'] = str(line)
          br.select_form(nr=0)
          br['q'] = str(line)
          isitwp_response = br.submit()
          isitwp_response = isitwp_response.read()
          if "Good news everyone" in a:
              rowdict['iswordpresswebsite'] = "yes"
          else:
              rowdict['iswordpresswebsite'] = "no"
  </code></pre>
  
  <p>The errors are as follow:</p>
  
  <pre><code>File "./wp_checker.py", line 26, in &lt;module&gt;
  br['q'] = str(line)
  
  File "/usr/local/lib/python2.7/dist-packages/mechanize/_mechanize.py", line 796, in __setitem__
  self.form[name] = val
  
  File "/usr/local/lib/python2.7/dist-packages/mechanize/_form_controls.py", line 1956, in __setitem__
  control = self.find_control(name)
  
  File "/usr/local/lib/python2.7/dist-packages/mechanize/_form_controls.py", line 2348, in find_control
  return self._find_control(name, type, kind, id, label, predicate, nr)
  
  File "/usr/local/lib/python2.7/dist-packages/mechanize/_form_controls.py", line 2441, in _find_control
  raise ControlNotFoundError("no control matching " + description)
  mechanize._form_controls.ControlNotFoundError: no control matching name 'q'
  </code></pre>