Errors when saving file with Assembly3
ivtts opened this issue · 2 comments
ivtts commented
With FreeCAD 0.21.2, when save file with Assembly3, on console printed errors
PropertyPythonObject::toString(): failed for <class 'freecad.asm3.assembly.Assembly'>
Traceback (most recent call last):
File "/usr/lib/python3.11/json/__init__.py", line 231, in dumps
return _default_encoder.encode(obj)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/json/encoder.py", line 200, in encode
chunks = self.iterencode(o, _one_shot=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/json/encoder.py", line 258, in iterencode
return _iterencode(o, 0)
^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/json/encoder.py", line 180, in default
raise TypeError(f'Object of type {o.__class__.__name__} '
<class 'TypeError'>: Object of type set is not JSON serializable
PropertyPythonObject::toString(): failed for <class 'freecad.asm3.assembly.AsmConstraintGroup'>
...
It seems that
class 'TypeError' Object of type FeaturePython is not JSON serializable
the problem was related with
git commit fbe2fef
It seems that when using python >=3.11 you need to rename the __getstate__
/__setstate__
methods to dumps
/loads
.
I tried doing this locally and now there are no errors.
My setup
OS: Arch Linux (XFCE/Xfce Session)
Word size of FreeCAD: 64-bit
Version: 0.21.2.33771 (Git)
Build type: Release
Branch: makepkg
Hash: b9bfa5c5507506e4515816414cd27f4851d00489
Python 3.11.6, Qt 5.15.11, Coin 4.0.1, Vtk 9.3.0, OCC 7.7.2
Locale: Russian/Russia (ru_RU)
Installed mods:
* DynamicData 2.60.0
* Assembly4 0.50.6
* Manipulator 1.5.6
* Help 1.0.3
* QuickMeasure 2022.10.28
* Woodworking-0.20 0.20.29177
* A2plus 0.4.61
* TabBar
* Assembly3 0.12.0
wsteffe commented