You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi everyone! I'm in VSCode and I have the extension from Microsoft for Python. I have the following error. Consider the following code without errors (a priori).
I am getting the following error from Pylance:
Cannot access member "bar3d" for type "Axes" Member "bar3d" is unknown
Cannot access member "set_zlabel" for type "Axes" Member "set_zlabel" is unknown
It seems like doing ax = cast(Axes3D, fig.add_subplot(projection='3d'))
solves the problem, but I would like to avoid that, as it is unnatural.
It seems that is related to: the stub for add_subplot would likely need an overload for the literal of projection='3d' (check microsoft/pyright#6690 (comment))
I believe this is ultimately the same problem as discussed in #27455, and in particular the advice at #27455 (comment) also applies here. That is, your existing use of cast is likely the best option, at least for now.
Bug summary
Hi everyone! I'm in VSCode and I have the extension from Microsoft for Python. I have the following error. Consider the following code without errors (a priori).
I am getting the following error from Pylance:
Cannot access member "bar3d" for type "Axes" Member "bar3d" is unknown
Cannot access member "set_zlabel" for type "Axes" Member "set_zlabel" is unknown
It seems like doing
ax = cast(Axes3D, fig.add_subplot(projection='3d'))
solves the problem, but I would like to avoid that, as it is unnatural.
It seems that is related to: the stub for add_subplot would likely need an overload for the literal of
projection='3d'
(check microsoft/pyright#6690 (comment))Code for reproduction
Actual outcome
Code with errors highlighted.
Expected outcome
Code without errors
Additional information
No response
Operating system
Arch
Matplotlib Version
3.8.1-1
Matplotlib Backend
No response
Python version
3.11.6
Jupyter version
No response
Installation
None
The text was updated successfully, but these errors were encountered: