Qpid
  1. Qpid
  2. QPID-2524

Fails loading dtd in Python 2.6 on Ubuntu 9.10 (Karmic) with "ValueError: unknown url type: /.../specs/amqp.0-10.dtd"

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Critical Critical
    • Resolution: Unresolved
    • Affects Version/s: 0.6
    • Fix Version/s: None
    • Component/s: Python Client
    • Labels:
    • Environment:

      Ubuntu 9.10 (Karmic)
      Python 2.6
      Qpid 0.6 (and trunk)

      Description

      In Python 2.6, importing qpid raises "ValueError: unknown url type: /.../specs/amqp.0-10.dtd"

      File "/usr/lib/python2.6/dist-packages/_xmlplus/sax/expatreader.py", line 109, in parse
      xmlreader.IncrementalParser.parse(self, source)
      File "/usr/lib/python2.6/dist-packages/_xmlplus/sax/xmlreader.py", line 123, in parse
      self.feed(buffer)
      File "/usr/lib/python2.6/dist-packages/_xmlplus/sax/expatreader.py", line 216, in feed
      self._parser.Parse(data, isFinal)
      File "/usr/lib/python2.6/dist-packages/_xmlplus/sax/expatreader.py", line 396, in external_entity_ref
      "")
      File "/usr/lib/python2.6/dist-packages/_xmlplus/sax/saxutils.py", line 523, in prepare_input_source
      f = urllib2.urlopen(source.getSystemId())
      File "/usr/lib/python2.6/urllib2.py", line 124, in urlopen
      return _opener.open(url, data, timeout)
      File "/usr/lib/python2.6/urllib2.py", line 381, in open
      protocol = req.get_type()
      File "/usr/lib/python2.6/urllib2.py", line 242, in get_type
      raise ValueError, "unknown url type: %s" % self.__original

      This didn't happen in Python 2.5 (on Ubuntu 8.10 at least). The xml.sax routines use urlopen which cannot handle the filename (at least without a file:// prefix).

      Reversing r656301 fixes this by always prefixing the filename with file:// (not just for Python 2.3). I'm not sure if this would fix it for all releases/versions though.

        Activity

        Hide
        Peter Kruse added a comment -

        Hello,

        it seems that mllib hasn't been updated yet accordingly.
        What prevents from applying this patch or fixing this in any other way?

        Regards,

        Peter

        Show
        Peter Kruse added a comment - Hello, it seems that mllib hasn't been updated yet accordingly. What prevents from applying this patch or fixing this in any other way? Regards, Peter
        Hide
        Angel Freire added a comment -

        In the xml_parse function defined in mllib's _init_ a check was performed to see if Python 2.3 was used and, in that case, append file:// to the file URL. I don't know why that check was there, file:// is necesary in all the Python versions I'm able to check (2.5 and 2.6)

        The given attach removes that check.

        Show
        Angel Freire added a comment - In the xml_parse function defined in mllib's _ init _ a check was performed to see if Python 2.3 was used and, in that case, append file:// to the file URL. I don't know why that check was there, file:// is necesary in all the Python versions I'm able to check (2.5 and 2.6) The given attach removes that check.
        Hide
        Angel Freire added a comment -

        Patch (in svn diff format) that removes a check that only appends "file://" to files URLs in Python 2.3. It should be applied in all Python versions.

        Show
        Angel Freire added a comment - Patch (in svn diff format) that removes a check that only appends "file://" to files URLs in Python 2.3. It should be applied in all Python versions.

          People

          • Assignee:
            Unassigned
            Reporter:
            Greg Gaughan
          • Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:

              Development