i can't click button type="submit" python mechanize
Question: i've this button :

    
    
    <input class="bi bj bk bl" type="submit" name="add_photo_done" value="معاينة">
    

but i can't click on it i tried this code :

    
    
    self.br.submit("add_photo_done")
    

but it's give me the following error:

    
    
       self.br.submit("add_photo_done")
    File "/usr/local/lib/python2.7/dist-packages/mechanize/_mechanize.py", line 541, in submit
       return self.open(self.click(*args, **kwds))
    File "/usr/local/lib/python2.7/dist-packages/mechanize/_mechanize.py", line 203, in open
       return self._mech_open(url, data, timeout=timeout)
    File "/usr/local/lib/python2.7/dist-packages/mechanize/_mechanize.py", line 230, in _mech_open
       response = UserAgentBase.open(self, request, data)
    File "/usr/local/lib/python2.7/dist-packages/mechanize/_opener.py", line 193, in open
       response = urlopen(self, req, data)
    File "/usr/local/lib/python2.7/dist-packages/mechanize/_urllib2_fork.py", line 344, in _open
    '_open', req)
    File "/usr/local/lib/python2.7/dist-packages/mechanize/_urllib2_fork.py", line 332, in _call_chain
       result = func(*args)
    File "/usr/local/lib/python2.7/dist-packages/mechanize/_urllib2_fork.py", line 1170, in https_open
       return self.do_open(conn_factory, req)
    File "/usr/local/lib/python2.7/dist-packages/mechanize/_urllib2_fork.py", line 1115, in do_open
       h.request(req.get_method(), req.get_selector(), req.data, headers)
    File "/usr/lib/python2.7/httplib.py", line 1052, in request
       self._send_request(method, url, body, headers)
    File "/usr/lib/python2.7/httplib.py", line 1092, in _send_request
       self.endheaders(body)
    File "/usr/lib/python2.7/httplib.py", line 1048, in endheaders
       self._send_output(message_body)
    File "/usr/lib/python2.7/httplib.py", line 890, in _send_output
       msg += message_body
    UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 252: ordinal not in range(128)
    

> i don't now where is the problem even though everythink is fine


Answer: At the beginning of your code set the encoding

    
    
    import sys  
    reload(sys)  
    sys.setdefaultencoding('utf8')
    

