pyside6-uic File is not valid error
-
I'm getting a failure with pyside6-uic saying the file is not valid. I have two ui files in my project and ones compiles just fine. It is however only 10kb in size. The one giving me the error is 153kb. It opens without issues in Designer and works fine using QUiLoader.
I run from within the virtual environment. I am using pyside 6.6.2.The exact error reads:
File 'myfile.ui' is not validIs there anything I can try to check the integrity of the XML or maybe steps I can take to isolate the problem?
-
@Improv-Jester
You could try reading it with some XML validating tool to check for syntax.However, I would suspect that the XML syntax is legal but it contains something the uic does not like. If you are really lucky you could try running
pyside6-uic
on it yourself in a terminal, leave output to stdout instead of file, and be able to see the code generated as it reads the file, so you would know how far it gets. However, it's quite possible that does not produce any output until the whole file has been read and parsed, in which case it won't help.Other than that, the only obvious way is to start "binary chopping" the
.ui
file contents. That means, you remove about half of it, obviously in a suitable place leaving valid XML. If that run through OK you repeat process; if it errors you restore the removed stuff and chop that again. Till you find the problem. -
@Improv-Jester you can also share one of the .ui files, or a snippet from it that doesn't work in order to check it out.
-
@CristianMaureira I think the problem is that OP has a "blob" of 153K and does not know where it it is getting to before it goes wrong! And I think 153K of text is a lot to post here :)
-
@JonB In the midst of this I had to rebuild the virtual environment. Running it in a terminal was a great idea. The problems seems to have gone away. I'm guessing while rebuilding I picked up a late Pyside6 lib version.
Thanks for taking the time to give me ideas.
-
@CristianMaureira Thanks for taking the time to suggest a next step. The problem seems to have gone after I was forced to rebuild my venv.