Help Needed: mechanize problem
#1
There are two streaming sites I use that are very similar, one has an xbmc script and I went about changing the script so that I could make it work with the other site. I ran into a problem I was hoping I could get some help with.

The problem is with the code block here:
Quote: try:
progress.update(10)
if LOGGEDIN==0:
BROWSER.open(STVBOARDURL+INDEXURL)
progress.update(20)
BROWSER.select_form(nr=1)
BROWSER.find_control("vb_login_md5password").readonly=False
BROWSER["vb_login_username"] = USER
BROWSER["vb_login_md5password"] = HEXPASS
progress.update(40)
response1 = BROWSER.submit()
progress.update(60)
LOGGEDIN=1
BROWSER.open(STVBOARDURL+CHANNELSURL)
progress.update(80)
linkno=1
for link in BROWSER.links(url_regex=re.compile("goto=newpost")):
desc = re.compile("\'.*\'").findall(link.attrs[1][1])
print desc
if len(desc)>0 and desc[0].find("Down")==-1:
CHANNELDESCS.append(desc[0])
CHANNELURLS.append(link.url)
linkno=linkno+1
except:
f=file('q:\\scripts\\TvAndSportStreams\\error2.txt','w')
f.write(str(sys.exc_info()))
f.close
dialog = xbmcgui.Dialog()
dialog.ok('TvAndSportStreams','Could not retrieve channels.')
progress.close()

The script will fail with the command "BROWSER.select_form(nr=1)" and I know the form I am looking for is the 2nd one. I dumped out the html received from the open command and it looks normal. That error2.txt that I am trying to write the exception to comes out blank/empty.

This script works perfectly ok when run on my PC (with the xbmc stuff stripped out). I don't program for a living, but I did get a programming degree so I'm not too afraid to poke around. Admittedly this is my first with xbmc scripting and python in general.

I'm just wondering if anyone has any pointers? At this point I can't seem to produce a useful error message that would point me in the right direction.

Thanks!
Reply

Logout Mark Read Team Forum Stats Members Help
Help Needed: mechanize problem0