[PyQt] uic triggering DeprecationWarning for 'U' universal newlines mode

Phil Thompson phil at riverbankcomputing.com
Fri Oct 26 10:06:26 BST 2018


On 25 Oct 2018, at 9:41 pm, Kyle Altendorf <sda at fstab.net> wrote:
> 
> Phil,
> 
> I'm getting a bunch of deprecation warnings from uic.  Could we remove the 'U' specification for open()?
> 
> https://ci.appveyor.com/project/KyleAltendorf/stlib/builds/19797968#L20879
> 
> c:\projects\stlib\venv\lib\site-packages\PyQt5\uic\objcreator.py:152: DeprecationWarning: 'U' mode is deprecated
>  plugin = open(filename, 'rU')
> 
> 
> https://docs.python.org/3/library/functions.html#open
>> Deprecated since version 3.4, will be removed in version 4.0: The 'U' mode.
> 
> My impression is that this is likely a carry-over from py2 and that in py3 it's default and controlled by the newline parameter to open() anyways.  I forget where PyQt5 stands at the moment on py2 support but even if that's still required something like the following shouldn't be too intrusive.
> 
>  plugin = open(filename, 'r' if sys.version_info >= (3,) else 'rU')
> 
> Thanks for any consideration.  For now I'll filter them.
> 
> https://docs.pytest.org/en/latest/warnings.html#deprecationwarning-and-pendingdeprecationwarning

It should be Ok to just remove the second argument completely.

Thanks,
Phil


More information about the PyQt mailing list