Error "something" is unknown import symbol (pyright-extended)

Question:
Hello. Please tell me why I started to have this syntax error? How to fix it? Underlines in this line of code
from firebase_admin import credentials, db
“credentials” и “db” and write: “credentials” is unknown import symbol
pyright-extended
Repl link:
https://replit.com/@Magistrmate/dzenbot

import firebase_admin
import telebot
from firebase_admin import credentials, db

import script

cred = credentials.Certificate(json.loads(os.environ['KEY']))

default_app = firebase_admin.initialize_app(cred, {
    'databaseURL':
    'https://big-signifier-398111-default-rtdb.firebaseio.com/'
})
1 Like

At the same time, the bot continues to work without any errors. The underscore just appeared. How to remove it?

Pyright-extended, the code intelligence, thinks (incorrectly) that credentials doesn’t exist. A google search suggests that this is probably a common issue with pyright.
To remove the warning, you can explicitly tell pyright-extended to ignore that line:

from firebase_admin import credentials, db  # type: ignore

Usually code intelligence is more configurable and you would be able to use a # noqa: RULE to ignore a specific rule, but in this case it is pyright-extended and not ruff.

1 Like