# Ida\_loader.gen\_file, does it throw exceptions?

**URL:** https://community.hex-rays.com/t/ida-loader-gen-file-does-it-throw-exceptions/293
**Category:** C++ SDK & IDAPython
**Tags:** idapython
**Created:** [April 19, 2025, 10:46am UTC](https://community.hex-rays.com/t/ida-loader-gen-file-does-it-throw-exceptions/293 "2025-04-19T10:46:47Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Harding](https://sea2.discourse-cdn.com/flex002/user_avatar/community.hex-rays.com/harding/32/37_2.png) [@Harding](https://community.hex-rays.com/u/Harding)
#### Post date: [April 19, 2025, 10:46am UTC](https://community.hex-rays.com/t/ida-loader-gen-file-does-it-throw-exceptions/293/1 "2025-04-19T10:46:47Z")

</div>

In your example [here](https://github.com/HexRaysSA/IDAPython/blob/9.0sp1/python/idc.py#L1056) you do not have any try around it but check the retval while [here](https://github.com/HexRaysSA/IDAPython/blob/d12e31eae9d678f647013527596a715dd378f989/examples/disassembler/produce_lst_file.py#L35) you do not check the return value but rather wrap it in a try catch.

Which one is correct?

---

<div class="post-metadata">

### Author: ![igor](https://sea2.discourse-cdn.com/flex002/user_avatar/community.hex-rays.com/igor/32/35_2.png) [@igor](https://community.hex-rays.com/u/igor)
#### Post date: [April 22, 2025, 9:08am UTC](https://community.hex-rays.com/t/ida-loader-gen-file-does-it-throw-exceptions/293/2 "2025-04-22T09:08:58Z")

</div>

The native API shouldn’t throw exceptions\*, but the Python wrapper might (e.g. when passed arguments are of incompatible types).  
\*One remote possibility is if there is an internal error. Normally they’re fatal but under IDAPython they’re converted to Python exceptions.
