Issue 51 in twill: 'ParseError' object has no attribute 'msg'

65 views
Skip to first unread message

codesite...@google.com

unread,
Oct 21, 2009, 5:10:21 PM10/21/09
to twill-...@googlegroups.com

Comment #1 on issue 51 by dzagidulin: 'ParseError' object has no
attribute 'msg'
http://code.google.com/p/twill/issues/detail?id=51

I'm getting the same error (with twill 0.9, python2.5 and Ubuntu 8.04):
Traceback (most recent call last):
File "/usr/bin/twill-sh", line 8, in <module>
load_entry_point('twill==0.9', 'console_scripts', 'twill-sh')()

File "/usr/lib/python2.5/site-packages/twill-0.9-py2.5.egg/twill/shell.py",
line
353, in main
never_fail=options.never_fail)

File "/usr/lib/python2.5/site-packages/twill-0.9-py2.5.egg/twill/parse.py",
line
178, in execute_file
_execute_script(inp, **kw)

File "/usr/lib/python2.5/site-packages/twill-0.9-py2.5.egg/twill/parse.py",
line
244, in _execute_script
''' % (n, sourceinfo, line.strip(),str(e).strip(),)
File "/usr/lib/python2.5/HTMLParser.py", line 59, in __str__
result = self.msg
AttributeError: 'ParseError' object has no attribute 'msg'

In my case, it's failing when I try to run a 'showforms' on a page that has
an ajax
field (a calendar picker). If I remove the field, I can run showforms and
successfully test that page. It's when I add the ajax field that twill
fails with the
error above.

--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

codesite...@google.com

unread,
Oct 22, 2009, 12:58:40 PM10/22/09
to twill-...@googlegroups.com

Comment #2 on issue 51 by dzagidulin: 'ParseError' object has no
attribute 'msg'
http://code.google.com/p/twill/issues/detail?id=51

Actually, I tracked down the source of the problem.

(Well, there's two problems. One is the 'ParseError' object has no
attribute 'msg'
part. This is caused by the fact that ClientForm defines its ParseError as
a simple
subclass of HTMLParseError. When a parse error is thrown, there's some
problem with
instantiation of the exception, so that exc.message is set, but not
exc.msg, which is
what the HTMLParseError exception class uses in its str() function. But
anyways, the
AttributeError merely masks the underlying parse error that started this in
the first
place).

The parse error (which, in this case was 'OPTION outside of SELECT' was
incorrect --
all my OPTION tags were inside the SELECT tag). But what caused /it/ was the
previously known issue, a <br/> with no space before the /.
This is mentioned in the mailing list post:
http://lists.idyll.org/pipermail/twill/2009-January/000941.html

So, putting in the space in the <br /> tag fixed the parse error.
(The underlying issue that the ParseError objects are not properly used or
initialized still remains).

Reply all
Reply to author
Forward
0 new messages