Project

Profile

Help

Bug #4409

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

Added by O'Neil Delpratt about 2 years ago. Updated about 2 years ago.

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

0%

Estimated time:
Found in version:
Fixed in version:
Platforms:

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

History

#1 Updated by O'Neil Delpratt about 2 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)

#2 Updated by Martin Honnen about 2 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)

Please register to edit this issue

Also available in: Atom PDF