Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pillow: Cannot access member "getbands" for type "Image" #556

Closed
tekumara opened this issue Nov 3, 2020 · 3 comments
Closed

pillow: Cannot access member "getbands" for type "Image" #556

tekumara opened this issue Nov 3, 2020 · 3 comments
Labels
fixed in next version (main) A fix has been implemented and will appear in an upcoming version typestub Issue relating to our bundled type stubs

Comments

@tekumara
Copy link

tekumara commented Nov 3, 2020

Environment data

  • Language Server version: Pylance language server 2020.10.3 (pyright b881f28d) starting
  • OS and version: macOS
  • Python version (& distribution if applicable, e.g. Anaconda): Python 3.7.9

Expected behaviour

No type error, see Image.getbands() docs

Actual behaviour

Cannot access member "getbands" for type "Image"
  Member "getbands" is unknown

Code Snippet / Additional information

from typing import Tuple
import PIL.Image


def bands(pimage: PIL.Image.Image) -> Tuple[str]:
    return pimage.getbands()
@github-actions github-actions bot added the triage label Nov 3, 2020
@judej judej added the typestub Issue relating to our bundled type stubs label Nov 3, 2020
@github-actions github-actions bot removed the triage label Nov 3, 2020
@falkben
Copy link

falkben commented Nov 25, 2020

For me I get

Import "PIL" could not be resolved from source"

on just the simple from PIL import Image

@jakebailey
Copy link
Member

I believe that's a different issue; that happens when pillow isn't found in the environment at all, i.e. it's not installed in the selected interpreter.

The stub will always be present, as it's bundled with Pylance (so we'll "resolve" it, but warn that the code may not run).

I haven't had the time to go back and fix up these stubs, unfortunately, but I don't think that impacts resolving the modules themselves.

@gramster gramster changed the title Cannot access member "getbands" for type "Image" pillow: Cannot access member "getbands" for type "Image" Dec 18, 2020
@jakebailey jakebailey added the fixed in next version (main) A fix has been implemented and will appear in an upcoming version label May 5, 2021
@jakebailey
Copy link
Member

This issue has been fixed in version 2021.5.0, which we've just released. You can find the changelog here: https://github.com/microsoft/pylance-release/blob/main/CHANGELOG.md#202150-5-may-2021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fixed in next version (main) A fix has been implemented and will appear in an upcoming version typestub Issue relating to our bundled type stubs
Projects
None yet
Development

No branches or pull requests

4 participants