'How to use except block with pylance errors in python 3
I wanted to create a code block except with a pylance error : reportMissingImports. But python doesn't recognize this error because it comes from pylance. Can anyone please tell me how to use except code block with pylance error ? Or give me the equivalent of this error in python basic errors ?
Solution 1:[1]
You could do something like:
try:
import module
except ImportError:
# import other_module
# pass
I think that is roughly the closest Exception that might be triggered at runtime.
You would want to uncomment one of the two lines in the except block depending on your use case.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | alexpdev |
