Closed clarnx closed 1 year ago
The file is from a mainframe so you will need to specify encoding for input.
I ran your record through using 'CP500' encoding and the record processed as follows:
{'MTI': '1644', 'DE24': '697', 'DE48': '010502500123071200000032815022010122001P', 'PDS0105': '0012307120000003281502201', 'PDS0122': 'P', 'DE71': 1}
For the CLI, the parameter is --in-encoding
Hi @adelosa thanks for the feedback. Your suggestion worked. Follow up question. So for example if MTI is 1644 and Function Code (DE 24) is 640 it means Currency Update. Is it possible for the package to convert to human readable format as well instead of codes?
Thanks.
That's a feature request but my view is it is beyond the scope of this package. You could leverage cardutil library to build a tool to meet your specific requirements. I am available for paid engagements if you want me to build it for you. Contact me via email for more details.
Hi @adelosa, i have been trying to read ipm file and getting the same error above but really dont understand the issue. only two item are printed then the error logs
try:
with open(file, 'rb') as infile:
file_content = mciipm.IpmReader(infile, encoding='cp500')
for i in file_content:
print(i)
except Exception as e:
print(f"Error: {e}")
Error: Error while loading ISO8583 record. Could you point what i might be doing wrong. Would appreciate your feedback Thank you
This indicates that there was an an error parsing the ISO8583 record. This exception captures an inner exception that you should print the details to see what is triggering the error.
try:
with open(file, 'rb') as infile:
file_content = mciipm.IpmReader(infile, encoding='cp500')
for i in file_content:
print(i)
except MciIpmDataError as e:
print(f"Error: {e}")
print(f"Inner error: {e.ex}")
print(f"Record data: {e.ex.binary_context_data}")
print(f"Record number: {e.record_number}")
Thanks. it worked after setting args blocked=True. Then, ipm source file one of the field DE55 value is byte string when i try to decode it the code below i get a weird string that is not readable.
b = ls[2]['DE55']
utf8_text = codecs.decode(b, 'cp500')
my target is to export the data to csv.
De55 is binary data (EMV) so that's probably correct.
Thanks for your help. I will research on it
I tried to convert the TT112 file to csv but I get the error below. The command I used was
mci_ipm_to_csv --debug TT112T0.2023-07-12-06-20-12.001
Using the option
--no1014blocking
results in the same error