[Qgis-developer] PluginBuilder writes a wrong import inside .py

Worth Lutz wal3 at mindspring.com
Tue Nov 3 06:55:49 PST 2015


This is not fixed.

Some background info:

http://gis.stackexchange.com/questions/139625/qgis-plugin-problems-importing-resources-resources-rc-file-plugin-doasnt-l/155599#155599

This is a problem with  "uic.loadUiType".

I have have determined that if you save your "ui" file in QT designer 
with the resources open after you have added a resource, you get this error.

This is because  QT designer adds

    <resources>
       <include location="resources.qrc"/>
    </resources>

at the end of the file and this causes uic.loadUiType to look for a 
"resources_rc" as "_rc" is a default suffix.

I think closing the resource browser before saving the "ui" file in QT 
Designer will keep this added resources lines from being added to the 
end of the "ui" file.

*Worth Lutz*


On 11/3/2015 6:03 AM, Richard Duivenvoorde wrote:
> On 03-11-15 11:45, Anita Graser wrote:
>> On Tue, Nov 3, 2015 at 10:49 AM, Geo DrinX <geodrinx at gmail.com
>> <mailto:geodrinx at gmail.com>> wrote:
>>
>>      Hello all,
>>
>>      probably you just know, but I found that "PluginBuilder"  plugin for
>>      QGIS  writes at line 26  of the main  .py  file the following code:
>>
>>      import resources
>>
>>      I think this is wrong,  because in run it returns a python error.
>>
>>      The correct code is:
>>
>>      import resources_rc
>>
>> ​Hi Roberto,
>> Afaik, the plugin builder code is not wrong. You just have to adjust the
>> name of the output file when compiling the resources.
>> Best wishes,
>> Anita​
> Hi Roberto,
>
> I've had this issue also some time ago, but according to Gary it should
> be fixed:
>
> https://github.com/g-sherman/Qgis-Plugin-Builder/issues/34
>
> Note off course that plugins build with an older version of the builder
> still will have the problem.
> If you still have this problem with a current plugin, please report back
> at the issuelist at Github
>
> Regards,
>
> Richard Duivenvoorde
>
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20151103/95df14d1/attachment.html>


More information about the Qgis-developer mailing list