Mike Jones
Mike Jones

Reputation: 135

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?

Upvotes: 0

Views: 1849

Answers (3)

arrmo
arrmo

Reputation: 11

FYI, issue seems to be UTF-8 encoding (when using -o), vs. UTF-16 LE (output redirect in PowerShell).

This also matches to above ... every byte has a 00 with it (16 bit vs. 8 bit).

Upvotes: 1

Joel Bispo Neto
Joel Bispo Neto

Reputation: 1

In pyside2-uic mainwindow.ui -o MainWindow.py

Use -o instead of >

Upvotes: 0

Mike Jones
Mike Jones

Reputation: 135

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.

Upvotes: 0

Related Questions