In VS Code, the Problems tab is showing errors when using os.path.join
, but the code actually runs. How do I tell MyPy that these are not errors?
I'm working on the Salome platform, and the existing code that runs shows the following as an error: (the specific program is envSalome.py, which is the program that starts the whole salome-meca show):
import os
kernel_root=os.getenv("KERNEL_ROOT_DIR")
kernel_root = os.path.realpath(kernel_root) # this is line 39 in the error below
sys.path[:0]=[os.path.join(kernel_root,"bin","salome")] # this is line 40 in the error below
This program runs without errors.
I've used the python interpreter link at the lower-left corner of VS Code to select the python3.exe that shipped with Salome (and which runs this code without errors).
My problem:
In the "Problems" tab of the Terminal window, MyPy is showing these errors:
Value of type variable "AnyStr" of "realpath" cannot be "Optional[str]" mypy(error) [39, 16]
Argument 1 to "join" has incompatible type "Optional[str]"; expected "Union[str, _PathLike[str]]" mypy(error) [40,29]