Osama Alam
Osama Alam

Reputation: 1

unable to load .fbx file using bpy on AWS lambda: " IMB_loadifffile: couldn't get mapping /tmp/. "

I am trying to run a docker image with blender in it on AWS lambda because i want to use a lambda function to render images and videos. I used this method: https://blog.theodo.com/2021/08/blender-serverless-lambda/ In this, a base image with blender installed is used and a python handler function is setup that invokes the script using blender's python api. The scipt downloads files from an s3 bucket and attempts to create a scene in which it imports the files.

Following is the code snippet from my script:


    def import_fbx(file_path, name, location=(0, 0, 0)):
        bpy.ops.import_scene.fbx(filepath=file_path)

        imported_objects = bpy.context.selected_objects
        for obj in imported_objects:
           obj.location = location
           obj.name = name


        avatar_action_path = "/tmp/photo_pose.fbx"
        avatar_path = "/tmp/osama_clubbie2.glb"

        
      
    s3.download_file(BUCKET_NAME,"fbx_animations/photo_pose.fbx", avatar_action_path)
    s3.download_file(BUCKET_NAME, "glb_objects/osama_clubbie2.glb", avatar_path)

    filename = f"test.png"

    #import action file, extract action, and delete
    action_import_name = "avatarAction"
    import_fbx(avatar_action_path, action_import_name)
    avatarActionObj = get_parent_obj_by_name(action_import_name)
    avatarAction = avatarActionObj.animation_data.action

I have verified the file "/tmp/photo_pose.fbx" exists using os.path.exists("/tmp/photo_pose.fbx") and it indeed does. So the download is successful from s3 but bpy can't read it. I keep getting the error: **IMB_loadifffile: couldn't get mapping /tmp/. **

Any help here would be highly appreciated.

Upvotes: 0

Views: 67

Answers (0)

Related Questions