Search code examples
pythonpython-3.7pyside2

pyside2-uic null bytes in output


I'm trying to convert Qt .ui files made using Qt Designer with pyside2-uic but the output starts with 2 garbage bytes then every other byte is a null.

Here's the start of the output:

FF FE 23 00 20 00 2D 00 2A 00 2D 00 20 00 63 00 6F 00 64 00 69 00 6E 00 67 00 3A 00 20 00 75 00 74 00 66 00 2D 00 38 00 20 00 2D 00 2A 00 2D 00 0D 00 0A 00 0D 00 0A 00 23 00 20 00 46 00 6F 00

If I remove the first 2 bytes and all the nulls the it works as expected.

I'm using Python 3.7 and the newest version of pyside2, is there any way to get pyside2-uic to output a valid file without having to run it through another script to pull out all the garbage?


Solution

  • This bug(?) only occurs when pyside2-uic is run in powershell and the output is redirected to a file.

    If using powershell use the -o option to specify an output file. Both methods work fine from a normal command prompt.