GNOME Bugzilla – Bug 354515
dogtail crashes with a UnicodeDecodeError: "'utf8' codec can't decode byte ..." error when running example
Last modified: 2006-09-18 21:07:21 UTC
Steps to reproduce: 1. Fedora Rawhide 2. python gedit-test-utf8-procedural-api.py 3. Stack trace: [pmuldoon@dhcp-199 examples]$ python gedit-test-utf8-procedural-api.py Creating logfile at /tmp/dogtail/logs/gedit-test-utf8-procedural-api_20060905-155027 ... Detecting distribution: Red Hat/Fedora/derived distribution GTK Accessibility Module initialized Bonobo accessibility support initialized Traceback (most recent call last):
+ Trace 71671
run('gedit')
focus.application(application)
app = self.desktop.findChild(predicate, recursive = False, retry = False)
result = findFirstChildSatisfying(self, pred, recursive)
if child.satisfies(pred):
return pred.satisfiedByNode(self)
return node.roleName=='application' and stringMatches(self.appName, node.name)
return scriptName.matchedBy(reportedName)
return stringsMatch(self.untranslatedString, string)
outString = outString.decode('utf-8')
return codecs.utf_8_decode(input, errors, True)
Other information: We first noticed this when the frysk dogtail test suite crashed on rawhide: The offending code (tree.root.application ....) # Start up Frysk run ( FryskBinary, appName=FRYSK_APP_NAME ) fryskObject = tree.root.application ( FRYSK_APP_NAME ) Crashed at that point. Checked sanity of FRYSK_APP_NAME turns out fine. However using the AT-SPI sniff tool in the Programming -> AT_SPI Browser menu reveals some applications with some odd names. One was named ?#? and others. I can affix a screenshot if you need it. Sanity checked with the examples. It seems when dogtail walks the tree, badly encoded strings cause it to crash.
Created attachment 72277 [details] Screenshot of AT-SPI sniff Added screenshot of AT_SPI sniff observing strange application names
Sigh. I guess dogtail needs yet another workaround to avoid broken apps. I encourage you to try and figure out which apps are broken, and to either let me know or file bugs on them yourself.
Agreed that the bad apps cause havoc. A two point approach. I'll try and identify the broken apps and report them. However, AT-SPI sniff deals with the busted names, can we make dogtail as robust as AT-SPI, or more robust? BTW Frysk is reported as Frysk, so it's not Frysk that is busted. It seems the tree walkers hits the weird names first, then dies.
My plan was to get this workaround written first thing today, but several other issues seem to have popped up in the meantime. It is a high priority, though.
I just committed a fix to this bug. Dogtail should never crash because of an invalid Unicode string again. If it does, please reopen this bug.
The bug was fixed in 0.6.0.