[PyQt] Python 3 import error

Giovanni Bajo rasky at develer.com
Fri Dec 3 10:13:04 GMT 2010


On Thu, 2010-12-02 at 17:30 -0500, Nathan Weston wrote:
> On 12/2/2010 5:11 PM, Thorsten Kampe wrote:
> > * Hans-Peter Jansen (Thu, 2 Dec 2010 20:16:13 +0100)
> >>>> sip.setapi('QVariant', 2)
> >
> > Unfortunately, when I set "sip.setapi('QVariant', 2)" then I can't run
> > the application as stand-alone Pyinstaller[1] executable (neither under
> > Windows nor Linux):
> > ValueError: API 'QVariant' has already been set to version 1
> >
> 
> PyInstaller somehow ends up importing PyQt before your code runs, so the 
> API version is implicitly set to 1. You can work around this by editing 
> support/rthooks/pyi_rth_qt4plugins.py and adding these lines before the 
> import of QtCore:
> 
> import sip
> sip.setapi('QVariant', 2)
> 

Exactly, as explained:
http://www.pyinstaller.org/wiki/PyQtChangeApiVersion

-- 
Giovanni Bajo   ::  rasky at develer.com
Develer S.r.l.  ::  http://www.develer.com

My Blog: http://giovanni.bajo.it
Last post: Compile-time Function Execution in D



More information about the PyQt mailing list