Error Import GLB file #107554

Closed
opened 2023-05-02 17:45:02 +02:00 by Bachelier-Baptiste · 11 comments

System Information
Operating system: Windows-10-10.0.19045-SP0 64 Bits
Graphics card: NVIDIA RTX A1000 Laptop GPU/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 528.02

Blender Version
Broken: version: 3.5.0, branch: blender-v3.5-release, commit date: 2023-03-29 02:56, hash: 1be25cfff18b
Worked: (newest version of Blender that worked as expected)

Short description of error
[Error Bad glTF: json error: utf-8
This message happen every time I try to import a GLB file in Blender.
It happen whatever the GLB file I use.
The problem don't come from file because I'm able to open it in other software as Adobe Substance Stager, internet viewer. ]

Exact steps for others to reproduce the error
Start Blender > File > Import glTF 2.0 > Choose my file on desktop.

**System Information** Operating system: Windows-10-10.0.19045-SP0 64 Bits Graphics card: NVIDIA RTX A1000 Laptop GPU/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 528.02 **Blender Version** Broken: version: 3.5.0, branch: blender-v3.5-release, commit date: 2023-03-29 02:56, hash: `1be25cfff18b` Worked: (newest version of Blender that worked as expected) **Short description of error** [Error Bad glTF: json error: utf-8 This message happen every time I try to import a GLB file in Blender. It happen whatever the GLB file I use. The problem don't come from file because I'm able to open it in other software as Adobe Substance Stager, internet viewer. ] **Exact steps for others to reproduce the error** Start Blender > File > Import glTF 2.0 > Choose my file on desktop.
Bachelier-Baptiste added the
Severity
Normal
Type
Report
Status
Needs Triage
labels 2023-05-02 17:45:03 +02:00
Member

Hi @Bachelier-Baptiste , it might be the issue of non-utf8 characters in your file path. You said choose file from desktop, is your windows user directory named with all English characters? If not there might be an issue on Windows where the encoding is really all over the place. Try putting your file to a path where it's completely made of ascii characters and see if problem persists.

Also, does blender show more error in log or console?

Tbf this is very likely a gltf importer issue. We do need to take into account of encoding issues for different charset, especially on windows which does not default to utf8.

Hi @Bachelier-Baptiste , it might be the issue of non-utf8 characters in your file path. You said choose file from desktop, is your windows user directory named with all English characters? If not there might be an issue on Windows where the encoding is really all over the place. Try putting your file to a path where it's completely made of ascii characters and see if problem persists. Also, does blender show more error in log or console? Tbf this is very likely a gltf importer issue. We do need to take into account of encoding issues for different charset, especially on windows which does not default to utf8.
Contributor

Please attach the actual file you tried to import.

The error comes from here

def load_json(content):
def bad_constant(val):
raise ImportError('Bad glTF: json contained %s' % val)
try:
text = str(content, encoding='utf-8')
return json.loads(text, parse_constant=bad_constant)
except ValueError as e:
raise ImportError('Bad glTF: json error: %s' % e.args[0])

which would not be affected by the encoding of the file path but by the content of the file.

Please attach the actual file you tried to import. The error comes from here https://projects.blender.org/blender/blender-addons/src/commit/ca16cf7e8b0036e7022130622eedba62b6c018e7/io_scene_gltf2/io/imp/gltf2_io_gltf.py#L65-L72 which would not be affected by the encoding of the file path but by the content of the file.

Hi,
Thanks @ChengduLittleA @scurest for your help.

I've tried to export again my 3D model coming from Optitex with different method, name or save location but nothing helped to solve the error. Always same error log.

So I've tried to export a simple cube from Blender as GLB and reopen it afterward in Blender. It worked. (save the file also on my desktop)

Hi, Thanks @ChengduLittleA @scurest for your help. I've tried to export again my 3D model coming from Optitex with different method, name or save location but nothing helped to solve the error. Always same error log. So I've tried to export a simple cube from Blender as GLB and reopen it afterward in Blender. It worked. (save the file also on my desktop)
Member

图片

Looks like indeed there are some weird characters if I drop this glb into an online viewer.

@scurest Can we fix the reading part in

text = str(content, encoding='utf-8')
to "try more encodings" ? (that would look kinda crappy tho 🤔 )

![图片](/attachments/b9f7438e-a0b6-4c7a-93d2-e8d8cc331a6b) Looks like indeed there are some weird characters if I drop this `glb` into an online viewer. @scurest Can we fix the reading part in https://projects.blender.org/blender/blender-addons/src/commit/ca16cf7e8b0036e7022130622eedba62b6c018e7/io_scene_gltf2/io/imp/gltf2_io_gltf.py#L69 to "try more encodings" ? (that would look kinda crappy tho 🤔 )
Member

The glTF validator says this file is not compliant with the glTF specification
https://github.khronos.org/glTF-Validator/

image

Even if we can tweak the code to open it, not sure we have to do it. Policy is to be as close as possible to the specification

The glTF validator says this file is not compliant with the glTF specification https://github.khronos.org/glTF-Validator/ ![image](/attachments/d9e388ea-a700-4895-b326-f0e041723f30) Even if we can tweak the code to open it, not sure we have to do it. Policy is to be as close as possible to the specification

Ho I think you found the issue @ChengduLittleA
I thought what you mentioned only concerned the file name, not the piece inside.
So i've changed all the name piece and export again. And it worked.

Ho I think you found the issue @ChengduLittleA I thought what you mentioned only concerned the file name, not the piece inside. So i've changed all the name piece and export again. And it worked.
Member

@Bachelier-Baptiste Not sure what you are using for exporting or converting your file into glTF, but you should report this bug to the corresponding team, as the glTF is not valid

@Bachelier-Baptiste Not sure what you are using for exporting or converting your file into glTF, but you should report this bug to the corresponding team, as the glTF is not valid

@JulienDuroure Yes of course, I will transmit all those information. thanks

@JulienDuroure Yes of course, I will transmit all those information. thanks
Contributor

The generator is FBX2glTF. Perhaps this bug report is related: https://github.com/facebookincubator/FBX2glTF/issues/108.

The generator is FBX2glTF. Perhaps this bug report is related: https://github.com/facebookincubator/FBX2glTF/issues/108.
Member

This ticket can be closed, but because we are not on blender-addons repo, I don't have the necessary rights.

This ticket can be closed, but because we are not on blender-addons repo, I don't have the necessary rights.

Indeed, will close this as there's no work to be done for this on our side.

Indeed, will close this as there's no work to be done for this on our side.
Blender Bot added
Status
Archived
and removed
Status
Needs Information from User
labels 2023-05-05 08:24:25 +02:00
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Code Documentation
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Viewport & EEVEE
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
5 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#107554
No description provided.