Blend2Bam "OSerror invalid argument"

I’m trying to convert a model of mine using blend2bam and the command:

C:\Panda3D\python\Scripts\blend2bam.exe world.blend world.bam -m legacy --blender-dir "C:\Program Files\Blender Foundation\Blender 3.4" --animations skip 

but ultimately the operation crashes giving me the error:

OSError: [Errno 22] Invalid argument: 'C:\\Users\\trici\\Desktop\\blender\\mn9l models\\C:\\Users\\trici\\AppData\\Local\\Temp\\tmpi0bvokq0'

I’m at my wit’s end and am not sure how to proceed. Does anyone know what’s going wrong?

This might be a question for @Moguri.

Sorry for not replying to this sooner!

It seems like blend2bam is running into an issue constructing paths to the temporary files (e.g., intermediate glTF files). Unfortunately, I am not sure how to go about debugging this. Is there more console output you can supply? At least getting a callstack would help narrow down the context.

Here’s a full copy of my console:

PS C:\Users\trici\Desktop\blender\mn9l_models> C:\Panda3D\python\Scripts\blend2bam.exe -m legacy --animations skip C:\Users\trici\Desktop\blender\mn9l_models\world.blend C:\Users\trici\Desktop\blender\mn9l_models\world.bam
Auto-detected Blender installed at C:\Program Files\Blender Foundation\Blender 3.5
Blender 3.5.0 (hash 1be25cfff18b built 2023-03-29 06:36:20)
Read prefs: C:\Users\trici\AppData\Roaming\Blender Foundation\Blender\3.5\config\userpref.blend
Read blend: C:\Users\trici\Desktop\blender\mn9l_models\world.blend
Error: Tangent space can only be computed for tris/quads, aborting
02:54:53 | WARNING: Could not calculate tangents. Please try to triangulate the mesh first.

Warning: Failed to find image data for grass.jpg, skipping
Warning: Failed to find image data for dirt.jpg, skipping

Blender quit
Traceback (most recent call last):
  File "c:\panda3d\python\lib\site-packages\blend2bam\cli.py", line 89, in convert
    tmp2dst.convert_single(tmpfile.name, dst)
  File "c:\panda3d\python\lib\site-packages\blend2bam\gltf2bam.py", line 62, in convert_single
    run_gltf2bam(src, dst, self.cli_args)
  File "c:\panda3d\python\lib\site-packages\blend2bam\gltf2bam.py", line 26, in run_gltf2bam
    runpy.run_module('gltf.cli', run_name='__main__', alter_sys=True)
  File "c:\panda3d\python\lib\runpy.py", line 205, in run_module
    return _run_module_code(code, init_globals, run_name, mod_spec)
  File "c:\panda3d\python\lib\runpy.py", line 96, in _run_module_code
    mod_name, mod_spec, pkg_name, script_name)
  File "c:\panda3d\python\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "c:\panda3d\python\lib\site-packages\gltf\cli.py", line 156, in <module>
    main()
  File "c:\panda3d\python\lib\site-packages\gltf\cli.py", line 120, in main
    gltf_data = parse_gltf_file(src)
  File "c:\panda3d\python\lib\site-packages\gltf\parseutils.py", line 58, in parse_gltf_file
    if is_glb_file(filepath):
  File "c:\panda3d\python\lib\site-packages\gltf\parseutils.py", line 6, in is_glb_file
    with open(filepath, 'rb') as glbfile:
OSError: [Errno 22] Invalid argument: 'C:\\Users\\trici\\Desktop\\blender\\mn9l_models\\C:\\Users\\trici\\AppData\\Local\\Temp\\tmp7pd313em'

Failed to convert all files
PS C:\Users\trici\Desktop\blender\mn9l_models>

This might be a bug when using absolute paths. Can you try using relative paths to see if that works around the issue?

1 Like

I also have the same problem

here’s my full error stack that is very similar

(vr) PS C:\Code\VirtualReality\VR_APC> blend2bam .\leoDisk.blend .\leoDisk.bam
Auto-detected Blender installed at C:\Program Files\Blender Foundation\Blender 3.5
Blender 3.5.0 (hash 1be25cfff18b built 2023-03-29 06:36:20)
Read prefs: C:\Users\lupoleon\AppData\Roaming\Blender Foundation\Blender\3.5\config\userpref.blend
Read blend: C:\Code\VirtualReality\VR_APC\leoDisk.blend


Blender quit
Traceback (most recent call last):
  File "C:\Users\lupoleon\AppData\Local\miniconda3\envs\vr\lib\site-packages\blend2bam\cli.py", line 89, in convert
    tmp2dst.convert_single(tmpfile.name, dst)
  File "C:\Users\lupoleon\AppData\Local\miniconda3\envs\vr\lib\site-packages\blend2bam\gltf2bam.py", line 62, in convert_single
    run_gltf2bam(src, dst, self.cli_args)
  File "C:\Users\lupoleon\AppData\Local\miniconda3\envs\vr\lib\site-packages\blend2bam\gltf2bam.py", line 26, in run_gltf2bam
    runpy.run_module('gltf.cli', run_name='__main__', alter_sys=True)
  File "C:\Users\lupoleon\AppData\Local\miniconda3\envs\vr\lib\runpy.py", line 210, in run_module
    return _run_module_code(code, init_globals, run_name, mod_spec)
  File "C:\Users\lupoleon\AppData\Local\miniconda3\envs\vr\lib\runpy.py", line 97, in _run_module_code
    _run_code(code, mod_globals, init_globals,
  File "C:\Users\lupoleon\AppData\Local\miniconda3\envs\vr\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\lupoleon\AppData\Local\miniconda3\envs\vr\lib\site-packages\gltf\cli.py", line 156, in <module>
    main()
  File "C:\Users\lupoleon\AppData\Local\miniconda3\envs\vr\lib\site-packages\gltf\cli.py", line 120, in main
    gltf_data = parse_gltf_file(src)
  File "C:\Users\lupoleon\AppData\Local\miniconda3\envs\vr\lib\site-packages\gltf\parseutils.py", line 58, in parse_gltf_file
    if is_glb_file(filepath):
  File "C:\Users\lupoleon\AppData\Local\miniconda3\envs\vr\lib\site-packages\gltf\parseutils.py", line 6, in is_glb_file
    with open(filepath, 'rb') as glbfile:
OSError: [Errno 22] Invalid argument: 'C:\\Code\\VirtualReality\\VR_APC\\C:\\Users\\lupoleon\\AppData\\Local\\Temp\\tmpcp1u6oyk'

Failed to convert all files

Was this issue resolved ? I am also facing a similar issue .