0
$\begingroup$

I am building a 3D web app with threejs, in javascript. For renders, i want to use a renderfarm, so :

  • i save threejs scenes in .glTF
  • i command line blender to import and save these scene in .blend with a blender python script
  • so my app will be able to send scenes to the renderfarm for realistic renders

And this works well (firsts 2 points) on my local computer, but when i do the same on my server, it makes the following error :


    Traceback (most recent call last):
      File "convert_to_blend.py", line 9, in <module>
        bpy.ops.import_scene.gltf(filepath=obj_out+'.glb') 
      File "/usr/share/blender/scripts/modules/bpy/ops.py", line 188, in __call__
        ret = op_call(self.idname_py(), None, kw)
    AttributeError: Calling operator "bpy.ops.import_scene.gltf" error, could not be found
Blender quit

I use this command line : blender --background -noaudio --scene blank.blend --python convert_to_blend.py -- render_test

and the python script convert_to_blend.py contains just :

    import bpy
    import sys
    argv = sys.argv
    argv = argv[argv.index("--") + 1:] # get all args after last "--"
    obj_out = argv[0]
    bpy.ops.import_scene.gltf(filepath=obj_out+'.glb') 
    bpy.ops.wm.save_as_mainfile(filepath=obj_out+'.blend')

Is someone know how to make blender find what he wants to work ? this :

    AttributeError: Calling operator "bpy.ops.import_scene.gltf" error, could not be found

I forget to indicate the Blender version on my server is : 2.72 (sub 0)

And Blender version on my local computer, where my command line works well, is 2.91.0

$\endgroup$
5
  • $\begingroup$ I said "hello everyone" at beginning, but it disappear systematicly... So sorry, and Hello Everyone" :) $\endgroup$ – Mza David Jan 10 at 2:08
  • $\begingroup$ Why are you testing two so different versions and expecting same results? $\endgroup$ – Duarte Farrajota Ramos Jan 10 at 2:12
  • $\begingroup$ glTF addon was not included in Blender until 2.80. Put 2.91 on your server and use that. $\endgroup$ – scurest Jan 10 at 2:25
  • $\begingroup$ yes you are right, I thought the same thing when I wrote it... So I have updated blender to the last version and now, it works. Wouhou ! Solved :) $\endgroup$ – Mza David Jan 10 at 4:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.