Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors when saving file with Assembly3 #1324

Open
ivtts opened this issue Jan 2, 2024 · 2 comments
Open

Errors when saving file with Assembly3 #1324

ivtts opened this issue Jan 2, 2024 · 2 comments

Comments

@ivtts
Copy link

ivtts commented Jan 2, 2024

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
Copy link

wsteffe commented Jan 24, 2024

I am also having an error when saving from asm3 with last LinkStable on Windows 10. When it happens FC is frozed and I have to kill it in task manager.
Saving same document with last LinkStable in Linux doesn't give any error. So may be it is a similar but a different problem than here reported.

image

@wsteffe
Copy link

wsteffe commented Jan 24, 2024

I will report it as a new issue because I have just seen that issue reported here was already fixed in
b0ba754

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants