<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hello Michal,
<br>
<br>
I've also had this error some times ago, I do not remember if I
succeed with pyuic4, nor the solution.<br>
<br>
But IMHO it is simpler to load "ui" files at runtime.<br>
Here is an example from "processing" plugin :<br>
<br>
import os<br>
from qgis.PyQt import uic<br>
<br>
pluginPath = os.path.split(os.path.dirname(__file__))[0]<br>
WIDGET, BASE = uic.loadUiType(<br>
os.path.join(pluginPath, 'ui', 'DlgConfig.ui'))<br>
<br>
class ConfigDialog(BASE, WIDGET):<br>
<br>
<br>
=> no need to run make or similar to create python files each
time you change something in your ui files.<br>
<br>
load the plugin from the source folder (create a symbolic link from
home QGIS plugins dir to plugin source dir)<br>
change something in the ui file<br>
reload the plugin using "plugin reloader" and you immediately see
the result in QGIS.<br>
<br>
Regards
<pre class="moz-signature" cols="72">Arnaud Morvan
Ingénieur logiciel
Tél: +33 (0)4 58 48 20 32
Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac Cedex
<a class="moz-txt-link-freetext" href="http://www.camptocamp.com">http://www.camptocamp.com</a></pre>
<div class="moz-cite-prefix">Le 11/05/2017 à 12:44, Michal
Zimmermann a écrit :<br>
</div>
<blockquote
cite="mid:CAKgN3YWg5Tasgejk7hYT57oNxNc3KiBYUM9X5wVzHEEq1Afw5Q@mail.gmail.com"
type="cite">
<div dir="ltr">Hi,
<div>I'm starting with qgis plugin development on ubuntu-based
Mint OS (v 18.1 Serena). I created a very simple form in Qt
Designer 4.8.7 and tried to convert it to python file with <br>
<div>
<div><br>
</div>
<div>pyuic4 -d form.ui -o form.py<br>
</div>
<div><br>
</div>
<div>This results in </div>
<div><br>
</div>
<div>
<div>Traceback (most recent call last):</div>
<div> File
"/usr/lib/python2.7/dist-packages/PyQt4/uic/port_v2/invoke.py",
line 34, in invoke</div>
<div> exit_status = driver.invoke()</div>
<div> File
"/usr/lib/python2.7/dist-packages/PyQt4/uic/driver.py",
line 59, in invoke</div>
<div> self._generate()</div>
<div> File
"/usr/lib/python2.7/dist-packages/PyQt4/uic/driver.py",
line 98, in _generate</div>
<div> self._opts.resource_suffix)</div>
<div> File
"/usr/lib/python2.7/dist-packages/PyQt4/uic/__init__.py",
line 173, in compileUi</div>
<div> winfo = compiler.UICompiler().compileUi(uifile,
pyfile, from_imports, resource_suffix)</div>
<div> File
"/usr/lib/python2.7/dist-packages/PyQt4/uic/Compiler/compiler.py",
line 55, in __init__</div>
<div> CompilerCreatorPolicy())</div>
<div> File
"/usr/lib/python2.7/dist-packages/PyQt4/uic/uiparser.py",
line 170, in __init__</div>
<div> self.factory = QObjectCreator(creatorPolicy)</div>
<div> File
"/usr/lib/python2.7/dist-packages/PyQt4/uic/objcreator.py",
line 94, in __init__</div>
<div> modinfo = plugin_locals["moduleInformation"]()</div>
<div> File "<string>", line 52, in
moduleInformation</div>
<div> File
"/usr/lib/python2.7/dist-packages/qgis/__init__.py",
line 26, in <module></div>
<div> from qgis.PyQt import QtCore</div>
<div> File
"/usr/lib/python2.7/dist-packages/qgis/PyQt/QtCore.py",
line 28, in <module></div>
<div> sip.setapi(api, 2)</div>
<div>ValueError: API 'QDate' has already been set to
version 1</div>
</div>
<div><br>
</div>
<div>If I
change /usr/lib/python2.7/dist-packages/qgis/PyQt/QtCore.py
line 28 to sip.setapi(api, 1), it works, QGIS starts with
a following message though:</div>
<div><br>
</div>
<div>
<p style="margin:0px"><span style="color:rgb(255,0,0)">Couldn't
load PyQGIS.<br>
Python support will be disabled.</span><br>
</p>
<pre style="margin-top:12px;margin-bottom:12px"><span style="font-family:"courier new,courier"">
Traceback (most recent call last):
File "", line 1, in
File "/usr/lib/python2.7/dist-packages/qgis/__init__.py", line 26, in
from qgis.PyQt import QtCore
File "/usr/lib/python2.7/dist-packages/qgis/PyQt/QtCore.py", line 28, in
sip.setapi(api, 1)
ValueError: API 'QDate' has already been set to version 2
</span></pre>
<p style="margin:0px">Python version:<br>
2.7.12 (default, Nov 19 2016, 06:48:10) <br>
[GCC 5.4.0 20160609]<br>
<br>
QGIS version:<br>
2.18.7 'Las Palmas', 3b30e6a</p>
</div>
<div><br>
</div>
<div>What exactly do I have to do to make the both sides
work?</div>
<div><br>
</div>
-- <br>
<div class="gmail_signature">
<div dir="ltr">
<div>Michal Zimmermann (zimmi) <br>
WWW: <a moz-do-not-send="true"
href="https://www.zimmi.cz" target="_blank">https://www.zimmi.cz</a></div>
</div>
</div>
</div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
QGIS-Developer mailing list
<a class="moz-txt-link-abbreviated" href="mailto:QGIS-Developer@lists.osgeo.org">QGIS-Developer@lists.osgeo.org</a>
List info: <a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/qgis-developer">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a>
Unsubscribe: <a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/qgis-developer">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a></pre>
</blockquote>
<br>
</body>
</html>