[XML-SIG] PyXML 0.8.2+Python 2.3 CVS gives encoding error

Walter Dörwald walter@livinglogic.de
Thu, 22 May 2003 13:34:58 +0200


This is a multi-part message in MIME format.
--------------010800060208030301090805
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 8bit

Martin v. Löwis wrote:
> Walter Dörwald <walter@livinglogic.de> writes:
> 
>>LookupError: unknown encoding: CHARSET
> 
> I've observed the same thing. It would be good if you could find out
> why that happens.

I'm attaching a detailed stack trace that shows local variables.

I guess this problem stems from xml/dom/en_US/LC_MESSAGES/4Suite.mo

The readable part looks like this:

Project-Id-Version: PACKAGE VERSION
PO-Revision-Date: Sun Feb 18 17:52:04 2001
Last-Translator: FULL NAME <EMAIL@ADDRESS>
Language-Team: LANGUAGE <LL@li.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=CHARSET
Content-Transfer-Encoding: ENCODING
Generated-By: pygettext.py 1.1

This looks to me like some default configuration that hasn't
been changed. I guess Python version before 2.3 simple ignored
this information (especially the Content-Type).

Maybe Python should fail back to the ASCII if the charset is
unknown?

Bye,
    Walter Dörwald

--------------010800060208030301090805
Content-Type: text/plain;
 name="gettext-stacktrace-long.txt"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="gettext-stacktrace-long.txt"

Python 2.3b1+ (#1, May 21 2003, 22:00:21) 
[GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-113)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import xml.dom
Traceback and locals (innermost call last; 7 frames, 0 dropped):

   File <stdin>, line 1, in ?
         __builtins__  = <module '__builtin__' (built-in)>
         __doc__       = None
         __file__      = '/home/walter/.pythonrc.py'
         __name__      = '__main__'
         help          = <pydoc.Helper instance>
         nested_scopes = _Feature((2, 1, 0, 'beta', 1), (2, 2, 0, 'alpha', 0), 16)

   File /usr/local/lib/python2.3/site-packages/_xmlplus/dom/__init__.py, line 237, in ?
      235     EMPTY_PREFIX = None
      236     
      237 >>> import MessageSource
      238     DOMExceptionStrings = MessageSource.__dict__['DOMExceptionStrings']
      239     EventExceptionStrings = MessageSource.__dict__['EventExceptionStrings']
         BAD_BOUNDARYPOINTS_ERR      = 1
         BadBoundaryPointsErr        = <class xml.dom.BadBoundaryPointsErr at 0x4057126c>
         DOMError                    = <class xml.dom.DOMError at 0x40560e0c>
         DOMException                = <class xml.dom.DOMException at 0x4056d02c>
         DOMImplementation           = <module 'xml.dom.DOMImplementation' from '/usr/local/lib/python2.3/site-packages/_xmlplus/dom/DOMImplementation.pyc'>
         DOMSTRING_SIZE_ERR          = 2
         DOMStringSizeErr            = <class xml.dom.DomstringSizeErr at 0x4056dbcc>
         DomstringSizeErr            = <class xml.dom.DomstringSizeErr at 0x4056dbcc>
         EMPTY_NAMESPACE             = None
         EMPTY_PREFIX                = None
         EventException              = <class xml.dom.EventException at 0x4056d26c>
         FT_EXCEPTION_BASE           = 1000
         FtException                 = <class xml.dom.FtException at 0x4056d7dc>
         HIERARCHY_REQUEST_ERR       = 3
         HTMLDOMImplementation       = <module 'xml.dom.html.HTMLDOMImplementation' from '/usr/local/lib/python2.3/site-packages/_xmlplus/dom/html/HTMLDOMImplementation.pyc'>
         HierarchyRequestErr         = <class xml.dom.HierarchyRequestErr at 0x4056dbfc>
         INDEX_SIZE_ERR              = 1
         INUSE_ATTRIBUTE_ERR         = 10
         INVALID_ACCESS_ERR          = 15
         INVALID_CHARACTER_ERR       = 5
         INVALID_MODIFICATION_ERR    = 13
         INVALID_NODE_TYPE_ERR       = 2
         INVALID_STATE_ERR           = 11
         IndexSizeErr                = <class xml.dom.IndexSizeErr at 0x4056d95c>
         InuseAttributeErr           = <class xml.dom.InuseAttributeErr at 0x4056dd7c>
         InvalidAccessErr            = <class xml.dom.InvalidAccessErr at 0x4056de6c>
         InvalidCharacterErr         = <class xml.dom.InvalidCharacterErr at 0x4056dc5c>
         InvalidModificationErr      = <class xml.dom.InvalidModificationErr at 0x4056de0c>
         InvalidNodeTypeErr          = <class xml.dom.InvalidNodeTypeErr at 0x4057129c>
         InvalidStateErr             = <class xml.dom.InvalidStateErr at 0x4056ddac>
         MessageSource               = <module 'xml.dom.MessageSource' from '/usr/local/lib/python2.3/site-packages/_xmlplus/dom/MessageSource.pyc'>
         NAMESPACE_ERR               = 14
         NOT_FOUND_ERR               = 8
         NOT_SUPPORTED_ERR           = 9
         NO_DATA_ALLOWED_ERR         = 6
         NO_MODIFICATION_ALLOWED_ERR = 7
         NamespaceErr                = <class xml.dom.NamespaceErr at 0x4056de3c>
         NoDataAllowedErr            = <class xml.dom.NoDataAllowedErr at 0x4056dcbc>
         NoModificationAllowedErr    = <class xml.dom.NoModificationAllowedErr at 0x4056dcec>
         Node                        = <class xml.dom.Node at 0x40560b6c>
         NotFoundErr                 = <class xml.dom.NotFoundErr at 0x4056dd1c>
         NotSupportedErr             = <class xml.dom.NotSupportedErr at 0x4056dd4c>
         Range                       = <module 'xml.dom.Range' from '/usr/local/lib/python2.3/site-packages/_xmlplus/dom/Range.pyc'>
         RangeException              = <class xml.dom.RangeException at 0x4056d4dc>
         SYNTAX_ERR                  = 12
         SyntaxErr                   = <class xml.dom.SyntaxErr at 0x4056dddc>
         UNSPECIFIED_EVENT_TYPE_ERR  = 0
         UnspecifiedEventTypeErr     = <class xml.dom.UnspecifiedEventTypeErr at 0x4056defc>
         UserDataHandler             = <class xml.dom.UserDataHandler at 0x40560c8c>
         VALIDATION_ERR              = 16
         ValidationErr               = <class xml.dom.ValidationErr at 0x4056decc>
         WRONG_DOCUMENT_ERR          = 4
         WrongDocumentErr            = <class xml.dom.WrongDocumentErr at 0x4056dc2c>
         XHTML_NAMESPACE             = 'http://www.w3.org/1999/xhtml'
         XMLNS_NAMESPACE             = 'http://www.w3.org/2000/xmlns/'
         XML_NAMESPACE               = 'http://www.w3.org/XML/1998/namespace'
         XML_PARSE_ERR               = 1001
         XmlParseErr                 = <class xml.dom.XmlParseErr at 0x4057123c>
         __builtins__                = {'help': Type help() for interactive help, or help(object) for help about object., 'vars': <built-in...ions.AttributeError at 0x4015474c>, 'OverflowError': <class exceptions.OverflowError at 0x401549bc>}
         __doc__                     = '\nWWW: http://4suite.org/4DOM         e-mail: support@4suite.org\n\nCopyright (c) 2000 Fourthought ....   All Rights Reserved.\nSee  http://4suite.org/COPYRIGHT  for license and copyright information\n'
         __file__                    = '/usr/local/lib/python2.3/site-packages/_xmlplus/dom/__init__.pyc'
         __name__                    = 'xml.dom'
         __path__                    = ['/usr/local/lib/python2.3/site-packages/_xmlplus/dom']
         html                        = <module 'xml.dom.html' from '/usr/local/lib/python2.3/site-packages/_xmlplus/dom/html/__init__.pyc'>
         implementation              = <xml.dom.html.HTMLDOMImplementation.HTMLDOMImplementation instance at 0x405dd1cc>

   File /usr/local/lib/python2.3/site-packages/_xmlplus/dom/MessageSource.py, line 24, in ?
      22         gettext.install('4Suite', locale_dir)
      23     except (ImportError, AttributeError, IOError):
      24 >>>     def _(msg):
      25             return msg
      26     
         BAD_BOUNDARYPOINTS_ERR      = 1
         DOMSTRING_SIZE_ERR          = 2
         HIERARCHY_REQUEST_ERR       = 3
         INDEX_SIZE_ERR              = 1
         INUSE_ATTRIBUTE_ERR         = 10
         INVALID_ACCESS_ERR          = 15
         INVALID_CHARACTER_ERR       = 5
         INVALID_MODIFICATION_ERR    = 13
         INVALID_NODE_TYPE_ERR       = 2
         INVALID_STATE_ERR           = 11
         NAMESPACE_ERR               = 14
         NOT_FOUND_ERR               = 8
         NOT_SUPPORTED_ERR           = 9
         NO_DATA_ALLOWED_ERR         = 6
         NO_MODIFICATION_ALLOWED_ERR = 7
         SYNTAX_ERR                  = 12
         UNSPECIFIED_EVENT_TYPE_ERR  = 0
         VALIDATION_ERR              = 16
         WRONG_DOCUMENT_ERR          = 4
         XML_PARSE_ERR               = 1001
         __builtins__                = {'help': Type help() for interactive help, or help(object) for help about object., 'vars': <built-in...ions.AttributeError at 0x4015474c>, 'OverflowError': <class exceptions.OverflowError at 0x401549bc>}
         __doc__                     = None
         __file__                    = '/usr/local/lib/python2.3/site-packages/_xmlplus/dom/MessageSource.pyc'
         __name__                    = 'xml.dom.MessageSource'
         gettext                     = <module 'gettext' from '/usr/local/lib/python2.3/gettext.pyc'>
         locale_dir                  = '/usr/local/lib/python2.3/site-packages/_xmlplus/dom'
         os                          = <module 'os' from '/usr/local/lib/python2.3/os.pyc'>

   File /usr/local/lib/python2.3/gettext.py, line 428, in install
      426     
      427     def install(domain, localedir=None, unicode=False):
      428 >>>     translation(domain, localedir, fallback=True).install(unicode)
      429     
      430     
         domain    = '4Suite'
         localedir = '/usr/local/lib/python2.3/site-packages/_xmlplus/dom'
         unicode   = False

   File /usr/local/lib/python2.3/gettext.py, line 416, in translation
      414             t = _translations.get(key)
      415             if t is None:
      416 >>>             t = _translations.setdefault(key, class_(open(mofile, 'rb')))
      417             # Copy the translation object to allow setting fallbacks.
      418             # All other instance data is shared with the cached object.
         class_    = <class gettext.GNUTranslations at 0x405e12fc>
         domain    = '4Suite'
         fallback  = True
         key       = '/usr/local/lib/python2.3/site-packages/_xmlplus/dom/en_US/LC_MESSAGES/4Suite.mo'
         languages = None
         localedir = '/usr/local/lib/python2.3/site-packages/_xmlplus/dom'
         mofile    = '/usr/local/lib/python2.3/site-packages/_xmlplus/dom/en_US/LC_MESSAGES/4Suite.mo'
         mofiles   = ['/usr/local/lib/python2.3/site-packages/_xmlplus/dom/en_US/LC_MESSAGES/4Suite.mo']
         result    = None
         t         = None

   File /usr/local/lib/python2.3/gettext.py, line 176, in __init__
      174             self._fallback = None
      175             if fp is not None:
      176 >>>             self._parse(fp)
      177     
      178         def _parse(self, fp):
         fp   = <open file '/usr/local/lib/python2.3/site-packages/_xmlplus/dom/en_US/LC_MESSAGES/4Suite.mo', mode 'rb' at 0x405e2f60>
         self = <gettext.GNUTranslations instance at 0x405e356c>

   File /usr/local/lib/python2.3/gettext.py, line 304, in _parse
      302                     if self._charset:
      303                         msg = unicode(msg, self._charset)
      304 >>>                     tmsg = unicode(tmsg, self._charset)
      305                     catalog[msg] = tmsg
      306                 # advance to next entry in the seek tables
         buf       = '\xde\x12\x04\x95\x00\x00\x00\x00\x01\x00\x00\x00\x1c\x00\x00\x00$\x00\x00\x00\x00\x00\x00\x00\x00\x...t/plain; charset=CHARSET\nContent-Transfer-Encoding: ENCODING\nGenerated-By: pygettext.py 1.1\n\x00'
         buflen    = 331
         catalog   = {}
         filename  = '/usr/local/lib/python2.3/site-packages/_xmlplus/dom/en_US/LC_MESSAGES/4Suite.mo'
         fp        = <open file '/usr/local/lib/python2.3/site-packages/_xmlplus/dom/en_US/LC_MESSAGES/4Suite.mo', mode 'rb' at 0x405e2f60>
         i         = 0
         ii        = '<II'
         item      = 'Generated-By: pygettext.py 1.1'
         k         = 'generated-by'
         lastk     = 'generated-by'
         magic     = 2500072158L
         masteridx = 28L
         mend      = 44L
         mlen      = 0L
         moff      = 44L
         msg       = u''
         msgcount  = 1L
         self      = <gettext.GNUTranslations instance at 0x405e356c>
         tend      = 330L
         tlen      = 285L
         tmsg      = 'Project-Id-Version: PACKAGE VERSION\nPO-Revision-Date: Sun Feb 18 17:52:04 2001\nLast-Translator: F... text/plain; charset=CHARSET\nContent-Transfer-Encoding: ENCODING\nGenerated-By: pygettext.py 1.1\n'
         toff      = 45L
         transidx  = 36L
         unpack    = <built-in function unpack>
         v         = 'pygettext.py 1.1'
         version   = 0L

LookupError: unknown encoding: CHARSET
>>> 
--------------010800060208030301090805--