The dataclass-function is not working. For example,
from dataclasses import dataclass
@dataclass
class Person:
name: str
age: int
p = Person("Jonas", 27)
print(p)
The error message occurs when I try to define p:
TypeError: Person() takes no arguments
Hence, dataclass is not handling the __init__ function appropriately.
The dataclasses.py file is in
C:\Users\Jonas\Desktop\Tut_Dataclass\test_env\Lib\site-packages (1),
where I also find a folder dataclasses-0.6.dist-info.
Typing where python in comand prompt (in VSCode) gives the correct location C:\Users\Jonas\Desktop\Tut_Dataclass\test_env\Scripts\python.exe.
Checking sys.pathshows that (1) is listed and therefore python should find the module dataclasses.
I checked numpy (installed via pip) and it works properly.
As a novice in VSCode and python, I appreciate any idea to solve this issue.