etree.RelaxNG fails to load RELAX NG compact (.rnc) file

Bug #1827833 reported by Yang Yang
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Fix Released

Bug Description

With rnc2rng 2.6.1 installed, etree.RelaxNG still fails to load a .rnc file.


start = element a {empty}

from lxml import etree
etree.RelaxNG(file='test.rnc') # ValueError: Unicode strings with encoding declaration are not supported. Please use bytes input or XML fragments without declaration.

It seems that the rng content generated by rnc2rng is rejected by etree.RelaxNG because it begins with '<?xml version="1.0" encoding="UTF-8"?>'.

Version info:

Python : sys.version_info(major=3, minor=7, micro=3, releaselevel='final', serial=0)
lxml.etree : (4, 3, 3, 0)
libxml used : (2, 9, 5)
libxml compiled : (2, 9, 5)
libxslt used : (1, 1, 30)
libxslt compiled : (1, 1, 30)

Revision history for this message
scoder (scoder) wrote :

Thanks for the report.
Fixed here:

As the saying goes, it's either tested or broken. The integration tests with rnc2rng were not automatically running in CI. They are now.

Changed in lxml:
assignee: nobody → scoder (scoder)
importance: Undecided → Medium
milestone: none → 4.4.0
status: New → Fix Committed
scoder (scoder)
Changed in lxml:
assignee: scoder (scoder) → nobody
milestone: 4.4.0 → none
status: Fix Committed → Fix Released
milestone: none → 4.4.0
Yang Yang (wdscxsj)
Changed in lxml:
status: Fix Released → Confirmed
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.