1
Consider this following code:
@dataclass
class Subjects(JSONWizard):
    subjectName: str =None
    subjectExpert: str = None
    subjectScore: float = None
@dataclass
class Student(JSONWizard):
    studentName: str
    studentId: str
    subjects: list[Subjects] = None
    teachers: list = None
    paidFee: bool = None
    gender: str = None
    attendancePercentage: float = None
    
sample_record = {
    "studentName":"Naveen", "studentId":"18B91A05L2","Subjects":[{"subjectName":"Telugu","subjectExpert":"Lingeswar","subjectScore":23.5}],
    "teachers":["BhaskarRao","LaxmiKumari","Louis"],"paidFee":True,"gender":"M", "attendancePercentage":98.2
}

dataclass_object: Student = Student.from_dict(sample_record)
print(dataclass_object.studentName)

I have ran it in python3.9 and its working fine but in python3.11 I am facing this error: dataclass_wizard.errors.ParseError: Failure parsing field None in class None. Expected a type Any, got NoneType. value: None error: Provided type is not currently supported. unsupported_type: typing.Any Can someone help me in understanding whats wrong here!

Sai Naveen
  • 19
  • 3

1 Answers1

0

I'm facing the same problem, but dataclasswizard is not officially supported for 3.11 based on their docs: https://dataclass-wizard.readthedocs.io/en/latest/.
What I consider we can do

  1. Use Pydantic
  2. Downgrade Python version to 3.10

enter image description here

  • This does not really answer the question. If you have a different question, you can ask it by clicking [Ask Question](https://stackoverflow.com/questions/ask). To get notified when this question gets new answers, you can [follow this question](https://meta.stackexchange.com/q/345661). You can also [add a bounty](https://stackoverflow.com/help/privileges/set-bounties) to draw more attention to this question. - [From Review](/review/low-quality-posts/34919398) – Jan Sep 01 '23 at 20:18