JSON export error - "a bytes-like object is required not str"

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
Post Reply
spols
Posts: 1
Joined: Thu Dec 31, 2020 2:30 pm

JSON export error - "a bytes-like object is required not str"

Post by spols »

Hello,

I just download the last version of freecad.

Code: Select all

OS: Windows 7
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.4 (GitTag)
Build type: Release
Branch: releases/FreeCAD-0-18
Hash: 980bf9060e28555fecd9e3462f68ca74007b70f8
Python version: 3.6.6
Qt version: 5.6.2
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: French/Belgium (fr_BE)
I used often the JSON export and it doesn't work anymore even with a simple volume as a cube
I get the error : "a bytes-like object is required not str"
I also see a longer message in red on the below status bar, but not long enough to copy them. (Is it a log somewhere ?)

Is it still possible to export as JSON ?
jmaustpc
Veteran
Posts: 11207
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: JSON export error - "a bytes-like object is required not str"

Post by jmaustpc »

Welcome to FreeCAD.
spols wrote: Thu Dec 31, 2020 2:39 pm I just download the last version of freecad.
Not really, that version is now rather old and is soon to be officially obsolete. Most of us have been using FreeCAD 0.19 (dev version) for a long time now, to take advantage of the over 6 thousand bug fix and new feature updates.
spols wrote: Thu Dec 31, 2020 2:39 pm I get the error : "a bytes-like object is required not str"
I wonder if that is a Python2/Python3 in comparability issue?

Just try the latest snap shot of 0.19 and see if all your problems go away, if not let us know.
heda
Veteran
Posts: 1348
Joined: Sat Dec 12, 2015 5:49 pm

Re: JSON export error - "a bytes-like object is required not str"

Post by heda »

indeed sounds like a py2/py3 issue.

if v0.19 works - use that one.

but....
if you are adventurous (read willing to modify python files) and the error stems from a pure python file, you should be able to patch it on your computer only.

where exactly does it error out and how does that line look like? (this you will find in the reportview)

fixing these things on an otherwise working installation is not hard in case of pure python, just might be a bit tedious if it is in multiple locations...
User avatar
DrInfiniteExplorer
Posts: 39
Joined: Wed Dec 30, 2020 2:16 am

Re: JSON export error - "a bytes-like object is required not str"

Post by DrInfiniteExplorer »

In the case that it can be fixed by local python patching, it should be added to the list of known issues/known fixes (forgot the link) so other users can work around the issue
Post Reply