[Eric] A glitch in warning of "unused" files

Algis Kabaila akabaila at pcug.org.au
Sat Aug 20 22:57:08 BST 2011


On Saturday 20 August 2011 18:25:58 Detlev Offenbach wrote:
> On Freitag, 19. August 2011, Algis Kabaila wrote:
> > On Friday 19 August 2011 21:31:46 Detlev Offenbach wrote:
> > > 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
> > 
> > Hi,
> > 
> > Thank you for a constructive answer.
> > 
> > I accept your answer without reservation - I agree that the resources in
> > Qt are a bit of magic...  The ignore warning "comment" is a good
> > solution as long as it applies only to the next warning.
> 
> The "comment" only applies to warnings for this particular line.
> 
> > I would not want to loose
> > the warnings completely as I am fond of them!
> > 
> > Regards,
> > Al.

Good! Thanks.

Al.


More information about the Eric mailing list