https://bugzilla.gnome.org/show_bug.cgi?id=606224 LDTP | pyldtp | unspecified
Summary: Exceptions do not return unicode data Classification: Other Product: LDTP Version: unspecified OS/Version: Linux Status: UNCONFIRMED Severity: normal Priority: Normal Component: pyldtp AssignedTo: ldtp-ma...@gnome.bugs ReportedBy: jta...@gmail.com QAContact: ldtp-dev@lists.freedesktop.org GNOME target: --- GNOME version: --- I was having a problem passing a unicode string to LdtpExecutionError: import ldtp try: raise ldtp.LdtpExecutionError(u"testraise\u221a") except Exception, e: print unicode(e) The exceptions in LDTP seem to be copied from examples in the Python documentation for overriding exceptions. Resultantly, they store the message in a variable called value rather than in the args variable like the base class. This wouldn't be a problem except that the base class has its own __unicode__ method which depends on the args variable, so calling unicode() on an LDTP exception returns a null string. Changing exceptions to just use the Exception class as-is resolves this issue. The attached patch also makes LDTP exceptions inherit from ldtp.Error so all LDTP exceptions can be caught by catching ldtp.Error. I think this was the original design philosophy but it wasn't implemented. There were quite a few places where an exception handler used LdtpExecutionError.value - these are updated in the 0002 patch. -- Configure bugmail: https://bugzilla.gnome.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA contact for the bug. You are watching the assignee of the bug. _______________________________________________ LDTP-dev mailing list LDTP-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/ldtp-dev