[PyQt] Writing dual python2/python3 code and the use of PyQt5.uic
me at the-compiler.org
Mon Mar 25 12:44:33 GMT 2019
On Mon, Mar 25, 2019 at 01:42:42PM +0100, Florian Bruhin wrote:
> On Sun, Mar 24, 2019 at 02:18:14PM +0000, Phil Thompson wrote:
> > On 24 Mar 2019, at 1:59 pm, Eli Schwartz <eschwartz at archlinux.org> wrote:
> > > The alternative is to add u'' decorations to the specific strings that
> > > cannot be python2's dual purpose str/bytes.
> > >
> > > I *think* this should be sufficient:
> > > https://github.com/eli-schwartz/pyqt5/commit/1a014130024530eb0241cec7ef7ffb82e2c69fc6
> > >
> > > patch:
> > > https://github.com/eli-schwartz/pyqt5/commit/1a014130024530eb0241cec7ef7ffb82e2c69fc6.patch
> > >
> > > (Applied on top of a tarball import as I could not find any version
> > > control sources for PyQt5.)
> > What about Python v3.3 and earlier?
> To get the same effect with compatibility for all versions, you could do
> something like this (untested):
> def u(s):
> return s if sys.version_info == 3 else unicode(s)
> And then use u("...") instead of u"..."
Whoops - my bad, Eli mentioned something similar already, should've read the
rest of the thread *before* replying :)
Sorry for the noise!
https://www.qutebrowser.org | me at the-compiler.org (Mail/XMPP)
GPG: 916E B0C8 FD55 A072 | https://the-compiler.org/pubkey.asc
I love long mails! | https://email.is-not-s.ms/
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 833 bytes
Desc: not available
More information about the PyQt