convert#
- hexrec.base.convert(in_path, out_path, in_format=None, out_format=None)[source]#
Converts a file into another format.
This is a simple helper function for basic conversion of a file on the filesystem into another record format.
The function returns the input and output file objects, for further processing by the user.
- Parameters:
in_path (str) – Input file path.
out_path (str) – Output file path. It can be the same as in_path.
in_format (str) – Name of the input format, within
FILE_TYPES
. IfNone
, it is guessed viaguess_format_name()
.out_format (str) – Name of the output format, within
FILE_TYPES
. IfNone
, it is guessed viaguess_format_name()
.
- Returns:
(in_file, out_file) – Input and output file objects used internally.
Examples
>>> from hexrec import convert >>> convert('simple.hex', 'simple.srec') >>> convert('simple.hex', 'simple.srec', in_format='ihex', out_format='srec')