<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">Hi, I (or we) also use the same method as Arnaud.</div><div class=""><br class=""></div><div class="">The only drawback is you can’t get the autocomplete from the python file (from the ui file). But the benefit is greater: no need to ship generated python code, no need to compile every time we change the .ui file. The development is faster now.</div><div class=""><br class=""></div><div class="">I don’t think we need to see the generated python code from the .ui file.</div><div class=""><br class=""></div><div class="">You can see here for the utilities method : <a href="https://github.com/inasafe/inasafe/blob/develop/safe/utilities/resources.py#L107" class="">https://github.com/inasafe/inasafe/blob/develop/safe/utilities/resources.py#L107</a> </div><div class=""><br class=""></div><div class="">Best Regards</div><div class=""><br class=""></div><br class=""><div><blockquote type="cite" class=""><div class="">On 12May, 2017, at 12:34, Michal Zimmermann <<a href="mailto:zimmicz@gmail.com" class="">zimmicz@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">Hi,<div class="">that looks like an interesting workaround! What are the pitfalls? Don't you need to see the real python code when developing? </div></div><div class="gmail_extra" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br class=""><div class="gmail_quote">On Thu, May 11, 2017 at 1:55 PM, Arnaud Morvan<span class="Apple-converted-space"> </span><span dir="ltr" class=""><<a href="mailto:arnaud.morvan@camptocamp.com" target="_blank" class="">arnaud.morvan@camptocamp.com</a>></span><span class="Apple-converted-space"> </span>wrote:<br class=""><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;"><div bgcolor="#FFFFFF" text="#000000" class="">Hello Michal,<span class="Apple-converted-space"> </span><br class=""><br class="">I've also had this error some times ago, I do not remember if I succeed with pyuic4, nor the solution.<br class=""><br class="">But IMHO it is simpler to load "ui" files at runtime.<br class="">Here is an example from "processing" plugin :<br class=""><br class="">import os<br class="">from qgis.PyQt import uic<br class=""><br class="">pluginPath = os.path.split(os.path.dirname(<wbr class="">__file__))[0]<br class="">WIDGET, BASE = uic.loadUiType(<br class="">   <span class="Apple-converted-space"> </span>os.path.join(pluginPath, 'ui', 'DlgConfig.ui'))<br class=""><br class="">class ConfigDialog(BASE, WIDGET):<br class=""><br class=""><br class="">=> no need to run make or similar to create python files each time you change something in your ui files.<br class=""><br class="">load the plugin from the source folder (create a symbolic link from home QGIS plugins dir to plugin source dir)<br class="">change something in the ui file<br class="">reload the plugin using "plugin reloader" and you immediately see the result in QGIS.<br class=""><br class="">Regards<pre class="m_-2501770787831927990moz-signature" cols="72">Arnaud Morvan
Ingénieur logiciel
Tél: <a href="tel:+33%204%2058%2048%2020%2032" value="+33458482032" target="_blank" class="">+33 (0)4 58 48 20 32</a>

Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac Cedex
<a class="m_-2501770787831927990moz-txt-link-freetext" href="http://www.camptocamp.com/" target="_blank">http://www.camptocamp.com</a></pre><div class=""><div class="h5"><div class="m_-2501770787831927990moz-cite-prefix">Le 11/05/2017 à 12:44, Michal Zimmermann a écrit :<br class=""></div></div></div><blockquote type="cite" class=""><div class=""><div class="h5"><div dir="ltr" class="">Hi,<div class="">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 class=""><div class=""><div class=""><br class=""></div><div class="">pyuic4 -d form.ui -o form.py<br class=""></div><div class=""><br class=""></div><div class="">This results in </div><div class=""><br class=""></div><div class=""><div class="">Traceback (most recent call last):</div><div class=""> <span class="Apple-converted-space"> </span>File "/usr/lib/python2.7/dist-<wbr class="">packages/PyQt4/uic/port_v2/<wbr class="">invoke.py", line 34, in invoke</div><div class="">   <span class="Apple-converted-space"> </span>exit_status = driver.invoke()</div><div class=""> <span class="Apple-converted-space"> </span>File "/usr/lib/python2.7/dist-<wbr class="">packages/PyQt4/uic/driver.py", line 59, in invoke</div><div class="">   <span class="Apple-converted-space"> </span>self._generate()</div><div class=""> <span class="Apple-converted-space"> </span>File "/usr/lib/python2.7/dist-<wbr class="">packages/PyQt4/uic/driver.py", line 98, in _generate</div><div class="">   <span class="Apple-converted-space"> </span>self._opts.resource_suffix)</div><div class=""> <span class="Apple-converted-space"> </span>File "/usr/lib/python2.7/dist-<wbr class="">packages/PyQt4/uic/__init__.<wbr class="">py", line 173, in compileUi</div><div class="">   <span class="Apple-converted-space"> </span>winfo = compiler.UICompiler().<wbr class="">compileUi(uifile, pyfile, from_imports, resource_suffix)</div><div class=""> <span class="Apple-converted-space"> </span>File "/usr/lib/python2.7/dist-<wbr class="">packages/PyQt4/uic/Compiler/<wbr class="">compiler.py", line 55, in __init__</div><div class="">   <span class="Apple-converted-space"> </span>CompilerCreatorPolicy())</div><div class=""> <span class="Apple-converted-space"> </span>File "/usr/lib/python2.7/dist-<wbr class="">packages/PyQt4/uic/uiparser.<wbr class="">py", line 170, in __init__</div><div class="">   <span class="Apple-converted-space"> </span>self.factory = QObjectCreator(creatorPolicy)</div><div class=""> <span class="Apple-converted-space"> </span>File "/usr/lib/python2.7/dist-<wbr class="">packages/PyQt4/uic/objcreator.<wbr class="">py", line 94, in __init__</div><div class="">   <span class="Apple-converted-space"> </span>modinfo = plugin_locals["<wbr class="">moduleInformation"]()</div><div class=""> <span class="Apple-converted-space"> </span>File "<string>", line 52, in moduleInformation</div><div class=""> <span class="Apple-converted-space"> </span>File "/usr/lib/python2.7/dist-<wbr class="">packages/qgis/__init__.py", line 26, in <module></div><div class="">   <span class="Apple-converted-space"> </span>from qgis.PyQt import QtCore</div><div class=""> <span class="Apple-converted-space"> </span>File "/usr/lib/python2.7/dist-<wbr class="">packages/qgis/PyQt/QtCore.py", line 28, in <module></div><div class="">   <span class="Apple-converted-space"> </span>sip.setapi(api, 2)</div><div class="">ValueError: API 'QDate' has already been set to version 1</div></div><div class=""><br class=""></div><div class="">If I change /usr/lib/python2.7/<wbr class="">dist-packages/qgis/PyQt/<wbr class="">QtCore.py line 28 to sip.setapi(api, 1), it works, QGIS starts with a following message though:</div><div class=""><br class=""></div><div class=""><div style="margin: 0px;" class=""><span style="color: rgb(255, 0, 0);" class="">Couldn't load PyQGIS.<br class="">Python support will be disabled.</span><br class=""></div><pre style="margin-top: 12px; margin-bottom: 12px;" class=""><span style="font-family: 'courier new,courier';" class="">
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/python2.7/dist-<wbr class="">packages/qgis/__init__.py", line 26, in 
    from qgis.PyQt import QtCore
  File "/usr/lib/python2.7/dist-<wbr class="">packages/qgis/PyQt/QtCore.py", line 28, in 
    sip.setapi(api, 1)
ValueError: API 'QDate' has already been set to version 2

</span></pre><div style="margin: 0px;" class="">Python version:<br class="">2.7.12 (default, Nov 19 2016, 06:48:10)<span class="Apple-converted-space"> </span><br class="">[GCC 5.4.0 20160609]<br class=""><br class="">QGIS version:<br class="">2.18.7 'Las Palmas', 3b30e6a</div></div><div class=""><br class=""></div><div class="">What exactly do I have to do to make the both sides work?</div><div class=""><br class=""></div>--<span class="Apple-converted-space"> </span><br class=""><div class="m_-2501770787831927990gmail_signature"><div dir="ltr" class=""><div class="">Michal Zimmermann (zimmi) <br class="">WWW:<span class="Apple-converted-space"> </span><a href="https://www.zimmi.cz/" target="_blank" class="">https://www.zimmi.cz</a></div></div></div></div></div></div><br class=""><fieldset class="m_-2501770787831927990mimeAttachmentHeader"></fieldset><br class=""></div></div><pre class="">______________________________<wbr class="">_________________
QGIS-Developer mailing list
<a class="m_-2501770787831927990moz-txt-link-abbreviated" href="mailto:QGIS-Developer@lists.osgeo.org" target="_blank">QGIS-Developer@lists.osgeo.org</a>
List info: <a class="m_-2501770787831927990moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" target="_blank">https://lists.osgeo.org/<wbr class="">mailman/listinfo/qgis-<wbr class="">developer</a>
Unsubscribe: <a class="m_-2501770787831927990moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" target="_blank">https://lists.osgeo.org/<wbr class="">mailman/listinfo/qgis-<wbr class="">developer</a></pre></blockquote><br class=""></div></blockquote></div><br class=""><br clear="all" class=""><div class=""><br class=""></div>--<span class="Apple-converted-space"> </span><br class=""><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr" class=""><div class="">Michal Zimmermann (zimmi) <br class="">WWW:<span class="Apple-converted-space"> </span><a href="https://www.zimmi.cz/" target="_blank" class="">https://www.zimmi.cz</a></div></div></div></div><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">_______________________________________________</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">QGIS-Developer mailing list</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><a href="mailto:QGIS-Developer@lists.osgeo.org" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">QGIS-Developer@lists.osgeo.org</a><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">List info:<span class="Apple-converted-space"> </span></span><a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Unsubscribe:<span class="Apple-converted-space"> </span></span><a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a></div></blockquote></div><br class=""></body></html>