Discussion:
[Pyzo] pyzo and PyQt4 - API 'QDate' has already been set to version 1
atti.mueller via Pyzo
2018-02-27 13:47:13 UTC
Permalink
Hi!
I'm using pyzo with a python distribution including PyQt4. When I run code which imports PyQt4 through another module it gives me the error above. It seems to be related to sip configuration inside the imported module:

Traceback (most recent call last):
File "J:\am\ShapeViewer.py", line 1, in <module>
from qgis.core import *
File "J:\osgeo4w\apps\qgis-ltr\python\qgis\__init__.py", line 26, in <module>
from qgis.PyQt import QtCore
File "J:\osgeo4w\apps\qgis-ltr\python\qgis\PyQt\QtCore.py", line 28, in <module>
sip.setapi(api, 2)
ValueError: API 'QDate' has already been set to version 1

ShapeViewer is my own module and it imports module qgis which itself imports PyQt\QtCore.

When i turn off PyQt4 in the shell configuration, the error does not rise. At this point I don't understand what causes this error AND why do i need a gui selection in shell configuration at all - what are the (dis-)advantages?

Regards,
Andreas
--
You received this message because you are subscribed to the Google Groups "Pyzo" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyzo+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Almar Klein
2018-03-01 14:19:03 UTC
Permalink
Hi,

the advantage of integrating the event loop is that an app (or e.g. a
visualization figure) can stay responsive, while the shell can also
still be used. Otherwise, Python is either keeping the GUI responsive OR
waiting for user input.

If you do not need this kind of interactivity, I'd indeed just set GUI
integration to None. At the moment I am not sure why the version is set
to 1. Maybe its the default version and it is set when Pyzo imports Qt.

Regards,
  Almar
Post by atti.mueller via Pyzo
Hi!
File "J:\am\ShapeViewer.py", line 1, in <module>
from qgis.core import *
File "J:\osgeo4w\apps\qgis-ltr\python\qgis\__init__.py", line 26, in <module>
from qgis.PyQt import QtCore
File "J:\osgeo4w\apps\qgis-ltr\python\qgis\PyQt\QtCore.py", line 28, in <module>
sip.setapi(api, 2)
ValueError: API 'QDate' has already been set to version 1
ShapeViewer is my own module and it imports module qgis which itself imports PyQt\QtCore.
When i turn off PyQt4 in the shell configuration, the error does not rise. At this point I don't understand what causes this error AND why do i need a gui selection in shell configuration at all - what are the (dis-)advantages?
Regards,
Andreas
--
You received this message because you are subscribed to the Google Groups "Pyzo" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyzo+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...