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

[Problem] <class 'TypeError'>: Object of type FeaturePython is not JSON serializable #927

Closed
2 tasks done
kevenwyld opened this issue Jan 7, 2024 · 1 comment
Closed
2 tasks done

Comments

@kevenwyld
Copy link

kevenwyld commented Jan 7, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Version

0.21 (Development)

Full version info

OS: Ubuntu Core 20 (sway/sway)
Word size of FreeCAD: 64-bit
Version: 2024.104.0.38929 (Git) Snap 124
Build type: Release
Branch: tag: 20240104stable
Hash: 975453f6aa33093edbcc835760d7a65123059b98
Python 3.8.10, Qt 5.15.7, Coin 4.0.1, Vtk 7.1.1, OCC 7.6.3
Locale: English/United States (en_US)
Installed mods: 
  * Assembly3 0.12.0
  * Curves 0.6.15
  * fasteners 0.4.71

Subproject(s) affected?

Fastners v0.4.70 (specifically the error seems to be related to <class 'FastenersCmd.FSViewProviderTree'>)

Problem description

During saving, or during autosave, I receive the following error. It doesn't seem to impact anything, and saved files work just fine.

12:33:34  PropertyPythonObject::toString(): failed for <class 'FastenersCmd.FSViewProviderTree'>
12:33:34  Traceback (most recent call last):
  File "/snap/freecad-realthunder/124/usr/lib/python3.8/json/__init__.py", line 234, in dumps
    return cls(
  File "/snap/freecad-realthunder/124/usr/lib/python3.8/json/encoder.py", line 201, in encode
    chunks = list(chunks)
  File "/snap/freecad-realthunder/124/usr/lib/python3.8/json/encoder.py", line 431, in _iterencode
    yield from _iterencode_dict(o, _current_indent_level)
  File "/snap/freecad-realthunder/124/usr/lib/python3.8/json/encoder.py", line 405, in _iterencode_dict
    yield from chunks
  File "/snap/freecad-realthunder/124/usr/lib/python3.8/json/encoder.py", line 438, in _iterencode
    o = _default(o)
  File "/snap/freecad-realthunder/124/usr/lib/python3.8/json/encoder.py", line 179, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '
<class 'TypeError'>: Object of type FeaturePython is not JSON serializable
12:33:34  PropertyPythonObject::toString(): failed for <class 'FastenersCmd.FSViewProviderTree'>
12:33:34  Traceback (most recent call last):
  File "/snap/freecad-realthunder/124/usr/lib/python3.8/json/__init__.py", line 234, in dumps
    return cls(
  File "/snap/freecad-realthunder/124/usr/lib/python3.8/json/encoder.py", line 201, in encode
    chunks = list(chunks)
  File "/snap/freecad-realthunder/124/usr/lib/python3.8/json/encoder.py", line 431, in _iterencode
    yield from _iterencode_dict(o, _current_indent_level)
  File "/snap/freecad-realthunder/124/usr/lib/python3.8/json/encoder.py", line 405, in _iterencode_dict
    yield from chunks
  File "/snap/freecad-realthunder/124/usr/lib/python3.8/json/encoder.py", line 438, in _iterencode
    o = _default(o)
  File "/snap/freecad-realthunder/124/usr/lib/python3.8/json/encoder.py", line 179, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '
<class 'TypeError'>: Object of type FeaturePython is not JSON serializable
12:34:45  PropertyPythonObject::toString(): failed for <class 'FastenersCmd.FSViewProviderTree'>
12:34:45  Traceback (most recent call last):
  File "/snap/freecad-realthunder/124/usr/lib/python3.8/json/__init__.py", line 234, in dumps
    return cls(
  File "/snap/freecad-realthunder/124/usr/lib/python3.8/json/encoder.py", line 201, in encode
    chunks = list(chunks)
  File "/snap/freecad-realthunder/124/usr/lib/python3.8/json/encoder.py", line 431, in _iterencode
    yield from _iterencode_dict(o, _current_indent_level)
  File "/snap/freecad-realthunder/124/usr/lib/python3.8/json/encoder.py", line 405, in _iterencode_dict
    yield from chunks
  File "/snap/freecad-realthunder/124/usr/lib/python3.8/json/encoder.py", line 438, in _iterencode
    o = _default(o)
  File "/snap/freecad-realthunder/124/usr/lib/python3.8/json/encoder.py", line 179, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '
<class 'TypeError'>: Object of type FeaturePython is not JSON serializable
12:34:45  PropertyPythonObject::toString(): failed for <class 'FastenersCmd.FSViewProviderTree'>
12:34:45  Traceback (most recent call last):
  File "/snap/freecad-realthunder/124/usr/lib/python3.8/json/__init__.py", line 234, in dumps
    return cls(
  File "/snap/freecad-realthunder/124/usr/lib/python3.8/json/encoder.py", line 201, in encode
    chunks = list(chunks)
  File "/snap/freecad-realthunder/124/usr/lib/python3.8/json/encoder.py", line 431, in _iterencode
    yield from _iterencode_dict(o, _current_indent_level)
  File "/snap/freecad-realthunder/124/usr/lib/python3.8/json/encoder.py", line 405, in _iterencode_dict
    yield from chunks
  File "/snap/freecad-realthunder/124/usr/lib/python3.8/json/encoder.py", line 438, in _iterencode
    o = _default(o)
  File "/snap/freecad-realthunder/124/usr/lib/python3.8/json/encoder.py", line 179, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '
<class 'TypeError'>: Object of type FeaturePython is not JSON serializable
12:34:45  Save AutoRecovery file: Needed time: 923ms

Anything else?

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@kevenwyld
Copy link
Author

Looks like this was fixed upstream maybe shaise/FreeCAD_FastenersWB#297 and FreeCAD#10460

We are merged with upstream on 2023.05.22 though so we don't have this fix yet.

realthunder pushed a commit that referenced this issue Apr 9, 2024
4.5.0 - 2023-10-07
Features
requirements-txt-fixer: also sort constraints.txt by default.
#857 PR by @lev-blit.
#830 issue by @PLPeeters.
debug-statements: add bpdb debugger.
#942 PR by @mwip.
#941 issue by @mwip.
Fixes
file-contents-sorter: fix sorting an empty file.
#944 PR by @RoelAdriaans.
#935 issue by @paduszyk.
double-quote-string-fixer: don't rewrite inside f-strings in 3.12+.
#973 PR by @asottile.
#971 issue by @XuehaiPan.
Migrating
now requires python >= 3.8.
#926 PR by @asottile.
#927 PR by @asottile.
4.4.0 - 2022-11-23
Features
forbid-submodules: new hook which outright bans submodules.
#815 PR by @asottile.
#707 issue by @ChiefGokhlayeh.
4.3.0 - 2022-06-07
Features
check-executables-have-shebangs: use git config core.fileMode to determine if it should query git.
#730 PR by @Kurt-von-Laven.
name-tests-test: add --pytest-test-first test convention.
#779 PR by @asottile.
Fixes
check-shebang-scripts-are-executable: update windows instructions.
#774 PR by @mdeweerd.
#770 issue by @mdeweerd.
check-toml: use stdlib tomllib when available.
#771 PR by @DanielNoord.
#755 issue by @sognetic.
check-added-large-files: don't run on non-file stages.
#778 PR by @asottile.
#777 issue by @skyj.
4.2.0 - 2022-04-06
Features
name-tests-test: updated display text.
#713 PR by @asottile.
check-docstring-first: make output more parsable.
#748 PR by @asottile.
check-merge-conflict: make output more parsable.
#748 PR by @asottile.
debug-statements: make output more parsable.
#748 PR by @asottile.
Fixes
check-merge-conflict: fix detection of ====== conflict marker on windows.
#748 PR by @asottile.
Updating
Drop python<3.7.
#719 PR by @asottile.
Changed default branch from master to main.
#744 PR by @asottile.
4.1.0 - 2021-12-22
Features
debug-statements: add pdbr debugger.
#614 PR by @cansarigol.
detect-private-key: add detection for additional key types.
#658 PR by @ljmf00.
check-executables-have-shebangs: improve messaging on windows.
#689 PR by @pujitm.
#686 issue by @jmerdich.
check-added-large-files: support --enforce-all with git-lfs.
#674 PR by @amartani.
#560 issue by @jeremy-coulon.
Fixes
check-case-conflict: improve performance.
#626 PR by @guykisel.
#625 issue by @guykisel.
forbid-new-submodules: fix false-negatives for pre-push.
#619 PR by @m-khvoinitsky.
#609 issue by @m-khvoinitsky.
check-merge-conflict: fix execution in git worktrees.
#662 PR by @errsyn.
#638 issue by @daschuer.
Misc.
Normalize case of hook names and descriptions.
#671 PR by @dennisroche.
#673 PR by @revolter.
4.0.1 - 2021-05-16
Fixes
check-shebang-scripts-are-executable fix entry point.
#602 issue by @Person-93.
#603 PR by @scop.
4.0.0 - 2021-05-14
Features
check-json: report duplicate keys.
#558 PR by @AdityaKhursale.
#554 issue by @adamchainz.
no-commit-to-branch: add main to default blocked branches.
#565 PR by @ndevenish.
check-case-conflict: check conflicts in directory names as well.
#575 PR by @slsyy.
#70 issue by @andyjack.
check-vcs-permalinks: forbid other branch names.
#582 PR by @jack1142.
#581 issue by @jack1142.
check-shebang-scripts-are-executable: new hook which ensures shebang'd scripts are executable.
#545 PR by @scop.
Fixes
check-executables-have-shebangs: Short circuit shebang lookup on windows.
#544 PR by @scop.
requirements-txt-fixer: Fix comments which have indentation
#549 PR by @greshilov.
#548 issue by @greshilov.
pretty-format-json: write to stdout using UTF-8 encoding.
#571 PR by @jack1142.
#570 issue by @jack1142.
Use more inclusive language.
#599 PR by @asottile.
Breaking changes
Remove deprecated hooks: flake8, pyflakes, autopep8-wrapper.
#597 PR by @asottile.
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

1 participant