Visual Studio Code questions #1626
Replies: 4 comments
-
There are a couple of things you can do here. For lists and other builtin types, you don't actually need to use the typing module (assuming you selected Python version in VS Code is >= 3.9). You can just write: self.measurements: list[PathMeasurement] = []It you really need something from the import micropython
if not micropython:
import typingThen you won't get the import error because the import is skipped at runtime but you can use it for type hints only. Note: I used |
Beta Was this translation helpful? Give feedback.
-
If it is intermittent, probably not much we can do. If something is missing completely or there is a reproducible bug, feel free to open an issue for it with exact step=by-step details on how to reproduce the problem. |
Beta Was this translation helpful? Give feedback.
-
It looks like there is a long-standing feature request in VS Code for something like this: microsoft/vscode#66982 In the meantime, I think the only thing you can do to make them go away is run your program again. |
Beta Was this translation helpful? Give feedback.
-
|
Thanks a bunch for the help. If I keep seeing error squiggles I'll try to figure out if there's a way to reproduce it. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm experimenting with PyBricks and Visual Studio code for my team for next year. I've followed @FLL-Team-24277's setup instructions and have some basic things working.
I have some questions about how to make things work better:
XboxController, and is currently showing up forNumber. Is there a way to fix this?from typing import Listand then do something likeself.measurements: List[PathMeasurement] = []and I get the autocomplete, but when I run the program I getImportError: no module named 'typing'. Would it be possible to make this work? As I understand it the typing library is just for autocomplete and other editor things, and doesn't do anything at runtime.For background, I'm mainly a C# / .NET programmer, so I don't know a whole lot about Python.
Beta Was this translation helpful? Give feedback.
All reactions