Search code examples
pythonvisual-studio-codepylance

Pylance getting "Expect expression" and "Zero-length tuple is not allowed in this context" for dict indexing


I am attempting to get a value from a h5 dataset using h5py with the dict-like indexing. I tested the code and it works, but pylance shows me this error in vscode.

The error "Expect expression" and "Zero-length tuple is not allowed in this context" are marked by the red underline in the picture below.

_artemis_file here is the h5 file. And the code snippet below is in a method.

EDIT: the method self.calc_points() returns a list.

enter image description here


Solution

  • looks like it was an error with how I added the type hint for the _artemis_file instance variable above.