0

I'm trying to send a message to Slack using Python and the slack_sdk library, but I'm getting an import error.

from slack_sdk import WebClient
from slack_sdk.errors import SlackApiError

The IDE (VS Code) is underlining both WebClient and SlackApiError with a warning. I've already installed the package using:

pip install slack_sdk

My environment:

Python 3.11
VS Code
slack_sdk version 3.26.1 (installed via pip)
Virtual environment active

I have verified that the package is installed correctly. Why am I getting this warning, and how can I fix it?

Any help would be appreciated!

What I've tried:

  • Restarting VS Code
  • Reinstalling the package
  • Checking spelling and import paths
Ajeet Verma
4,3934 gold badges20 silver badges31 bronze badges
asked May 20 at 8:43
4
  • you should post the exact error as well that you're getting Commented May 20 at 8:56
  • error: Import "slack_sdk" could not be resolvedPylancereportMissingImports , I'm just trying to install the library. Commented May 20 at 10:28
  • always put full error message because there are other useful information. Commented May 21 at 16:14
  • do you get errors or warnings? If warnings then check if code runs - and if code runs then don't worry about warnings. And don't bother of IDE underlinings. And if you get error then maybe you have two Python installed and your pip install code for one Python but your IDE use other Python to run code. And it may need to get /full/path/to/python (ie. print(sys,executable)) and run /full/path/to/python -m pip install .... This problem was in many other questions on Stackoverflow Commented May 21 at 16:18

0

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.