Project

Profile

Help

Bug #4409

closed

TypeError: expected bytes, str found in saxonc.PyXQueryProcessor.set_query_base_uri

Added by O'Neil Delpratt almost 5 years ago. Updated almost 3 years ago.

Status:
Closed
Priority:
Normal
Category:
Python
Start date:
2019-12-17
Due date:
% Done:

100%

Estimated time:
Applies to branch:
Fix Committed on Branch:
Fixed in Maintenance Release:
Found in version:
Fixed in version:
11.1
SaxonC Languages:
SaxonC Platforms:
SaxonC Architecture:

Description

Reported by user here: https://saxonica.plan.io/boards/4/topics/7727

The code:

xquery_processor.set_query_base_uri(base_uri)

Gives the error:

xquery_processor.set_query_base_uri(base_uri)
File "saxonc.pyx", line 2493, in saxonc.PyXQueryProcessor.set_query_base_uri
self.thisxqptr.setQueryBaseURI(base_uri)
TypeError: expected bytes, str found
Actions #1

Updated by O'Neil Delpratt almost 5 years ago

  • Status changed from New to Resolved

The fix in the set_query_base_uri function is to change the line:

xquery_processor.set_query_base_uri(base_uri)

To the following which uses the C converted string:

xquery_processor.set_query_base_uri(c_content)
Actions #2

Updated by Martin Honnen almost 5 years ago

Fixed it locally with

     def set_query_base_uri(self, base_uri):
        """
        set_query_base_uri(self, base_uri)
        Set the static base query for the query     

        Args:
            base_uri (str): The static base URI; or None to indicate that no base URI is available
        """
        py_content_string = base_uri.encode('UTF-8') if base_uri is not None else None
        c_content = py_content_string if base_uri is not None else ""
        self.thisxqptr.setQueryBaseURI(c_content) #self.thisxqptr.setQueryBaseURI(base_uri)
Actions #3

Updated by O'Neil Delpratt almost 3 years ago

  • Status changed from Resolved to Closed
  • % Done changed from 0 to 100
  • Fixed in version set to 11.1

Bug fix patched in SaxonC 11.1 release

Please register to edit this issue

Also available in: Atom PDF