Reputation: 823
I have installed the PIL
library using pip
like this:
pip install Pillow
and it's working fine also showing library path in interrupter PyCharm Options.
But Autocomplete is not working, I tried to turn off the Power Save Mode and added custom virtual env, but it's still not working.
Any idea why it does not work?
So it's now showing sub methods :
from PIL import Image
im = Image.open("bride.jpg")
im.rotate(45).show()
Upvotes: 2
Views: 3112
Reputation: 139
The problem is that:
https://pillow.readthedocs.io/en/3.0.x/handbook/tutorial.html#using-the-image-class
To avoid clashes with my project on the name "Image", as well as to stay Pep8 and adhere to google's style guide, I opted for:
from PIL import Image as PilImage
my_image: PilImage.Image = PilImage.open("my_image.png")
my_image.show()
Running on python 3.8.2
Upvotes: 0
Reputation: 106
PyCharm doesn't know the type of im
as the library has no type hints for Image.open()
. So I decided to set local type hint like this:
your_image = Image.open(path_to_image) # type: Image.Image
your_image.now_shows_list = True
For complete reference look at JetBrains type hints documentation.
Upvotes: 9