# How can I export asset file to BMP by the python script

**URL:** <https://forums.unrealengine.com/t/how-can-i-export-asset-file-to-bmp-by-the-python-script/630111>\
**Category:** Editor Scripting\
**Tags:** Python, unreal-engine, UE5-0, question\
**Created:** [August 17, 2022, 9:40am UTC](https://forums.unrealengine.com/t/how-can-i-export-asset-file-to-bmp-by-the-python-script/630111 "2022-08-17T09:40:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_a5f69df21](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_a5f69df21](https://forums.unrealengine.com/u/anonymous_user_a5f69df21)\
**Post date:** [August 17, 2022, 9:40am UTC](https://forums.unrealengine.com/t/how-can-i-export-asset-file-to-bmp-by-the-python-script/630111/1 "2022-08-17T09:40:46Z")

</div>

here is my script

```auto
export_path = r"/Game/test"
root_package_path = "/Game/test"
asset_data_array = unreal.AssetRegistryHelpers.get_asset_registry().get_assets_by_path(root_package_path)
unreal.log(len(asset_data_array))

for asset_data in asset_data_array:
    asset_name = asset_data.get_editor_property('asset_name')
    path = os.path.join(export_path, "%s.bmp" % asset_name)
    exporter = unreal.TextureExporterBMP()
    task = unreal.AssetExportTask()
    task.set_editor_property("object", asset_data.get_asset())
    task.set_editor_property("filename", path)
    task.set_editor_property("exporter", exporter)
    task.set_editor_property("automated", True)
    task.set_editor_property("prompt", False)
    task.set_editor_property("replace_identical", True)
    task.set_editor_property("write_empty_files", True)
    # task.set_editor_property("errors", errors)

    ret = unreal.Exporter.run_asset_export_task(task)
    unreal.log(ret)
    errors = task.get_editor_property("errors")
    unreal.log(errors)

```

I got the errors:  
couldn’t open file

---

<div class="post-metadata">

**Author:** ![TON14](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@TON14](https://forums.unrealengine.com/u/TON14)\
**Post date:** [January 17, 2024, 1:49pm UTC](https://forums.unrealengine.com/t/how-can-i-export-asset-file-to-bmp-by-the-python-script/630111/2 "2024-01-17T13:49:25Z")

</div>

here is mistake  
`ret = unreal.Exporter.run_asset_export_task(task)`

you should use your created exporter  
`exporter.run_asset_export_task(task)`

```auto
            tga_exporter = unreal.TextureExporterTGA()
            
            export_task = unreal.AssetExportTask()
            export_task.exporter = tga_exporter
            export_task.automated = True
            export_task.filename= r"D:\folder\texture.tga"
            export_task.object = texture_like_object
            export_task.prompt = False
            
            tga_exporter.run_asset_export_task(export_task)

```
