I've been searching answers for this for the past hour and I'm feeling like any already asked question just barely misses my case.
I have been tinkering with the PIL library in Python, trying my first time to manipulate pixels, when all of a sudden a "Cannot find reference '[' in 'None'" Warning pops out. Naturally, I tried to read the IDE's warning and looked up simillar warnings online but only ended up with "missing imports" or "wrongly set interpreters".
This is the code in question:
from PIL import Image
with Image.open("./shoop_da_whoop.jpg") as img:
pixel = img.load()
width, height = img.size
for x in range(0, width, 2):
for y in range(0, height, 2):
pixel[x, y] = (255, 0, 0)
img.show()
The warning is right under the bracket: pixel*[*x, y] = (255, 0, 0). I have no clue whats going on and I will gladly try every advise.
I'm running Python 3.10 on the PyCharm version 2022.1
PyCharm relies on typeshed stubs here and there is a mistake (or rather a missing type annotation) in them - load()
method is declared to return None
class Image:
...
def load(self) -> None: ...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With