Improve error message when decompiling archive without specifying ar_index
jamuwu opened this issue · 1 comments
jamuwu commented
Traceback (most recent call last):
File "dec.py", line 6, in <module>
decompilation = decompiler.start_decompilation(input_file=sys.argv[1])
File "/usr/local/lib/python3.5/dist-packages/retdec/decompiler.py", line 112, in start_decompilation
id = self._start_decompilation(conn, kwargs)
File "/usr/local/lib/python3.5/dist-packages/retdec/decompiler.py", line 154, in _start_decompilation
response = conn.send_post_request(files=files, params=params)
File "/usr/local/lib/python3.5/dist-packages/retdec/conn.py", line 65, in send_post_request
response = self._send_request('post', path, params=params, files=files)
File "/usr/local/lib/python3.5/dist-packages/retdec/conn.py", line 124, in _send_request
self._ensure_request_succeeded(response)
File "/usr/local/lib/python3.5/dist-packages/retdec/conn.py", line 143, in _ensure_request_succeeded
json['description']
retdec.exceptions.UnknownAPIError: Parameter 'ar_index' is missing.
s3rvac commented
Thank you for your report. When decompiling archives (.a
or .lib
files), you have to select which file from the archive you want to decompile. The reason is that RetDec can decompile only a single file at once. This selection is done via the ar_index
parameter (see RetDec's docs), which is what the exception is telling you. For example, if you want to decompile the first file in the archive, you need to pass ar_index=0
to start_decompilation()
.
The only thing I can do is try improving the error message in retdec-python to make the cause more obvious. The original message you see comes from RetDec's API.