[Eric] A glitch in warning of "unused" files
Detlev Offenbach
detlev at die-offenbachs.de
Fri Aug 19 12:31:46 BST 2011
On Freitag, 19. August 2011, Algis Kabaila wrote:
> Hi Detlev,
>
> The attached script shows how a required file is marked as unused with a
> warning. The warning is
>
> Warning: "qrc_hi" imported but unused.
>
> However, in line 27 of hi.py the qrc_hi is used, though the reference to it
> is indirect and in a rather obscure format. I attach the script hi.py,
> hi.qrc, hi.ui and an icon from a small collection of icons, to enable an
> independent verification. The XML file hi.qrc shows how the
> "document-new.png" fits in the small package of icons.
>
> The debugger check of unused files and variables has proved itself
> extremely useful, at least for me - I was really surprised how many times
> I had unused variables and files - thank you for such a useful facility!
>
> Regards,
> Al.
Hi,
due to the fact, that the magic of Qt resource scripts is activated by purely
importing them, the checker sees this situation as an unused import. There is
no way (known to me) how to recognize this situation. However, if you mark the
import with a comment of "# __IGNORE_WARNING__", the warning provided by
pyflakes for the "unused" import will be ignored. With this comment one can
suppress false warnings everywhere in the code. This special comment must be
in the line to be ignored.
Regards,
Detlev
--
Detlev Offenbach
detlev at die-offenbachs.de
More information about the Eric
mailing list