Skip to content

[A2P] Python 3.11.x and above Json Fix for FreeCAD 0.21.2 and above#614

Merged
kbwbe merged 1 commit intokbwbe:tmpfrom
Syres916:Py311_Json_Fix
Jan 18, 2024
Merged

[A2P] Python 3.11.x and above Json Fix for FreeCAD 0.21.2 and above#614
kbwbe merged 1 commit intokbwbe:tmpfrom
Syres916:Py311_Json_Fix

Conversation

@Syres916
Copy link
Copy Markdown
Contributor

@Syres916 Syres916 commented Jan 18, 2024

In order to fix errors using Python 3.11.x and above while preserving ability for Python 3.10.x and below to still work correctly, example error from another workbench:

  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 FeaturePython is not JSON serializable
17:04:02  PropertyPythonObject::toString(): failed for <class 'SheetMetalCmd.SMViewProviderFlat'>
17:04:02  pyException: 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)
           ^^^^^^^^^^^^^^^^^

Root Cause is FreeCAD/FreeCAD@fbe2fef

Fixes #613

@kbwbe kbwbe changed the base branch from master to tmp January 18, 2024 20:38
@kbwbe kbwbe merged commit c5410ba into kbwbe:tmp Jan 18, 2024
@kbwbe
Copy link
Copy Markdown
Owner

kbwbe commented Jan 18, 2024

THX @Syres916. Your PR has been merged to master branch.
I wasn't aware of that changes within FC.

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

Successfully merging this pull request may close these issues.

JSON serialisation error

2 participants