Why does Qt complain about invalid XML version in ui file

282 Views Asked by At

I'm trying to port an application from PyQt5 to PySide6 because it's the official bindings (for now I guess). I have a .ui file designed in Qt Designer. It loads fine using PyQt5 uic, but PySide6 gives me the following error:

Designer: An error has occurred while reading the UI file at line 1, column 38: Unsupported XML version.

The first line of that file says:

<?xml version="2.0" encoding="UTF-8"?>

I've tried loading the file dynamically and I've tried to compile the .ui file using pyside6-uic. I get the same error each time.

Why can't PySide6 read my ui file?

1

There are 1 best solutions below

0
ekhumoro On

There's no such xml version as 2.0 - the only specified versions are 1.0 and 1.1. Qt will currently refuse to load ui files that aren't xml version 1.0, so I don't know how you ended up with anything different. Anyway, just manually change the version to 1.0, and everything should work as expected.

PS: as a nice irony, the so-called "unofficial" PyQt tools will handle any xml version, valid or otherwise (-;