Receiving the following error when trying to iterate over objects as values in a dict, and passing those objects to schema.dump(dev_obj) to be printed.

TypeError: dump() missing 1 required positional argument: 'obj'

Successfully able to dump and print a single object instances, not in a dict, but can not repeat the success iterating over multiple objects.

... # below, single instance works fine

test = MsnDevice()

schema = MsnDeviceSchema()

result = schema.dump(test)



...... # but, when iterating over a dict, in which the device object is a value in the dict, I get the above error # I have verified that the objects are indeed created and stored in values

schema = msn.MsnDeviceSchema

for device, dev_obj in msn_dict.items():

    device_json_string = schema.dump(dev_obj)



Expected results, is that I would be able to pprint each object.

1 Answers

Rick Armanino On

I found resolution to this issue, in short a typo.

in defining the schema in the dict iteration portion of the code, I did not include the '()' in the statement:


 # Incorrect
 schema = msn.MsnDeviceSchema

 # Corrected
 schema = msn.MsnDeviceSchema()