I am trying to select a form on the Dell Kace Ticket Sales Page, but I am getting a parsing error. I program in python and use mechanize. I was able to successfully log in to the site. I read that you can fix this with html cleaners like Beautiful soup, but none of them worked.
br = mechanize.Browser() #have tried the various html cleaner options in mechanize cj = cookielib.LWPCookieJar() br.set_cookiejar(cj) br.set_handle_equiv(True) br.set_handle_redirect(True) br.set_handle_referer(True) br.set_handle_robots(False) br.addheaders = [('User-agent', 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.1)Gecko/2008071615 Fedora/3.0.1-1.fc9 Firefox/3.0.1')] .... url_ticket = 'http://kace-server/adminui/ticket.php?ID=%d' %(box1[sel+1]) url_org1 = "http://kace-server/common/switch_to_org.php?org=1" br.open(url_org1) br.open(url_ticket) br.select_form(name="ticket_form") br.form['fields[owner_filter]']=current_user[0] br.submit()
The program does not work on the br.select_form line with the following error
line 39, in assign br.select_form(name="ticket_form") .... File "C:\Python27\lib\site-packages\mechanize-0.2.5-py2.7.egg\mechanize\_form.py", line 760, in feed raise ParseError(exc) ParseError: expected name token at '<!\xe2\x80\x94IE7 mode --\n <'
I was looking for this line !! xe2 ... in html but could not find it. I also tried nr = 0 for select_form. Any help would be greatly appreciated.
Thanks James
James source share