load#

hexrec.base.load(in_path, *load_args, in_format=None, **load_kwargs)[source]#

Loads a file.

This is a simple helper function to load a record file from the filesystem.

All the custom load_args and load_kwargs are forwarded to the actual underlying call to BaseFile.load().

Parameters:
  • in_path (str) – Input file path.

  • in_format (str) – Name of the input format, within FILE_TYPES. If None, it is guessed via guess_format_name().

Returns:

BaseFile – The loaded record file object.

Examples

>>> from hexrec import load
>>> load('simple.hex')  
<hexrec.formats.ihex.IhexFile object at ...>
>>> load('simple.hex', in_format='ihex')  
<hexrec.formats.ihex.IhexFile object at ...>
>>> load('simple.hex', ignore_errors=True)  
<hexrec.formats.ihex.IhexFile object at ...>