[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[pygame] pygame.image.load - PyCharm inspection warning



I have two questions about pygame.image.load.  Here's the first:

I use IDLE when I teach classes.  But when I am trying to develop something for myself, I use PyCharm Community Edition.  There are many things I like about PyCharm and one of them is the analysis of errors that is available in the right edge of the editor window (inside the scroll bar area).  It gives me a very nice "inspection" check on errors and warnings in my code.  While I can ignore many of the warnings, I like to get rid of as many as possible.  One of the warning messages is annoying and I don't understand it.

I have built a minimal text case to demonstrate the problem:

import pygame

testImage = pygame.image.load('images/testImage.png')
print('testImage is:', testImage)


With just this program in an edit window, I get a warning message on the line with pygame.image.load call.  The warning message says:

   Cannot find reference 'load' in 'image.py' more ...

If I click on the more, it tells me: 
    
     This inspection detects names that should resolve but don't.  Due to dynamic dispatch and duck typing, this is possible in a limited but useful number of cases.  Top-level and class-level items are supported better than instance items.


If I run the program, it correctly outputs:

('testImage is:', <Surface(5x9x32 SW)>)

I have used pygame.image.load for years without any problems.  My code is working fine.

My question is, is there anything that can be done to eliminate this warning message?

Thanks,

Irv