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

Kyle Altendorf sda at fstab.net
Thu Oct 25 21:41:41 BST 2018


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

Cheers,
-kyle


More information about the PyQt mailing list