resolve "cannot find reference"

I'm getting an inspection error: "Cannot find reference 'setLineWidth' in ''"

However I can plainly see that this file is in External Libraries.  Inspection doesn't complain about the import statements or the initialization of Canvas.  I can also plainly see in the source that there truely is a setLineWidth method declared in Canvas.

    from reportlab.lib.pagesizes import letter
    from reportlab.pdfgen import canvas

    canvas = canvas.Canvas("form.pdf", pagesize=letter)

This is a screen shot form the External Libraries tree:


Does anyone know how I can get inspection to see this source code?
Comment actions Permalink
Hi Jeremy,

This inspection tells that it cannot find setLineWidth class or method directly in That is because you have the same name for your variable as your import name. In case you will change this name:
    canvas1 = canvas.Canvas("form.pdf", pagesize=letter)
the method will be searched in canvas.Canvas so you will not see this inspection.
Comment actions Permalink
That was the problem.  My bad! Thank you very much!

Please sign in to leave a comment.