[twill] Working around <br/> issue?
Misha Koshelev
misha680 at gmail.com
Wed Dec 30 18:56:22 PST 2009
Howard B. Golden wrote:
> On Wednesday December 30, 2009, you wrote:
>> Thank you. Very helpful!!! I have used the following code:
>>
>> go http://www.google.com/voice#trash
>> fv 1 Email email
>> fv 1 Passwd passwd
>> submit
>> run "b=get_browser();b.result.page=b.result.page.replace('<br/>','<br
>> />');"
>>
>> It works as I can confirm with a save_html. However, when doing a
> showforms I still get:
>>>> showforms
>> Traceback (most recent call last):
>> File "/usr/bin/twill-sh", line 20, in <module>
>> twill.shell.main()
>> File "/var/lib/python-support/python2.5/twill/shell.py", line 387,
>> in main shell.cmdloop(welcome_msg)
>> File "/usr/lib/python2.5/cmd.py", line 142, in cmdloop
>> stop = self.onecmd(line)
>> File "/usr/lib/python2.5/cmd.py", line 219, in onecmd
>> return func(arg)
>> File "/var/lib/python-support/python2.5/twill/shell.py", line 42,
>> in do_cmd print '\nERROR: %s\n' % (str(e),)
>> File "/usr/lib/python2.5/HTMLParser.py", line 59, in __str__
>> result = self.msg
>> AttributeError: 'ParseError' object has no attribute 'msg'
>>
>> Any idea how I can figure out what's causing this? I'd like to avoid
>> sending the HTML to a public list, but will gladly send over
>> personal (individual) email.
>
> If you look at the traceback, it is _very_ strange. The error occurred
> in HTMLParser.py line 59, which is part of the HTMLParseError class.
> However, it was called from shell.py line 42, which is an exception
> handler for a twill.parse.execute_command (or at least is _should_ be).
> But based on the traceback, somehow, the _str_() method of
> HTMLParseError is being executed instead.
>
> I'm not sure what is going on, but I suspect it may have to do with
> Titus's manipulation of the global and local dictionaries in shell.py
> line 25. If my suspicion is correct, the "parse" in line 42 is referring
> to an HTMLParser object instead of a twill.parse object.
>
> As far as how to proceed, you could step through shell.py right there
> (in the do_cmd method) and see what type is being used. Another approach
> that might be easier is to put "twill." in front of "parse." on lines
> 30, 31 and 37 of shell.py. This will make sure that the right "parse" is
> being used. If it corrects the problem, then it supports my hypothesis.
>
> Howard
Ok no luck with your theory. I added an import twill at the top (I am a Python newbie - completely) and added
twill. in front of lines 30, 31, and 37 of shell.py (see attached). Still getting same error
misha at misha-d630:~/personal/web/googlevoice$ cat gvtrashempty | twill-sh
-= Welcome to twill! =-
current page: *empty page*
>> current page: *empty page*
>> ==> at https://www.google.com/accounts/ServiceLogin?passive=true&service=grandcentral<mpl=bluebar&continue=https%3A%2F%2Fwww.google.com%2Fvoice%2Faccount%2Fsignin%2F%3Fprev%3D%252F&gsessionid=WMJMv0xJwU--eHRZeHbddQ
current page: https://www.google.com/accounts/ServiceLogin?passive=true&service=grandcentral<mpl=bluebar&continue=https%3A%2F%2Fwww.google.com%2Fvoice%2Faccount%2Fsignin%2F%3Fprev%3D%252F&gsessionid=WMJMv0xJwU--eHRZeHbddQ
>> current page: https://www.google.com/accounts/ServiceLogin?passive=true&service=grandcentral<mpl=bluebar&continue=https%3A%2F%2Fwww.google.com%2Fvoice%2Faccount%2Fsignin%2F%3Fprev%3D%252F&gsessionid=WMJMv0xJwU--eHRZeHbddQ
>> current page: https://www.google.com/accounts/ServiceLogin?passive=true&service=grandcentral<mpl=bluebar&continue=https%3A%2F%2Fwww.google.com%2Fvoice%2Faccount%2Fsignin%2F%3Fprev%3D%252F&gsessionid=WMJMv0xJwU--eHRZeHbddQ
>> Note: submit is using submit button: name="signIn", value="Sign in"
current page: https://www.google.com/voice/?gsessionid=3r_m3iQXq_x0Ka_aL0Exqg
>> current page: https://www.google.com/voice/?gsessionid=3r_m3iQXq_x0Ka_aL0Exqg
>> Traceback (most recent call last):
File "/usr/bin/twill-sh", line 20, in <module>
twill.shell.main()
File "/var/lib/python-support/python2.5/twill/shell.py", line 388, in main
shell.cmdloop(welcome_msg)
File "/usr/lib/python2.5/cmd.py", line 142, in cmdloop
stop = self.onecmd(line)
File "/usr/lib/python2.5/cmd.py", line 219, in onecmd
return func(arg)
File "/var/lib/python-support/python2.5/twill/shell.py", line 43, in do_cmd
print '\nERROR: %s\n' % (str(e),)
File "/usr/lib/python2.5/HTMLParser.py", line 59, in __str__
result = self.msg
AttributeError: 'ParseError' object has no attribute 'msg'
Any ideas?
I don't know how to trace through I'm afraid. Any suggestions. I'm on Hardy Heron 8.04
Thank you
Misha Koshelev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: shell.py
Type: text/x-python
Size: 11504 bytes
Desc: not available
URL: <http://lists.idyll.org/pipermail/twill/attachments/20091230/6248984b/attachment-0001.py>
More information about the twill
mailing list