cardutil icon indicating copy to clipboard operation
cardutil copied to clipboard

Error while loading ISO record

Open clarnx opened this issue 3 years ago • 7 comments

I tried to convert the Mastercard file but it didn't work.

clarnx avatar Jul 16 '23 20:07 clarnx

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

adelosa avatar Jul 18 '23 07:07 adelosa

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.

adelosa avatar Jul 18 '23 23:07 adelosa

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

alikulaOwen avatar Sep 06 '23 09:09 alikulaOwen

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}")

adelosa avatar Sep 06 '23 11:09 adelosa

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.

alikulaOwen avatar Sep 06 '23 13:09 alikulaOwen

De55 is binary data (EMV) so that's probably correct.

adelosa avatar Sep 06 '23 21:09 adelosa

Thanks for your help. I will research on it

alikulaOwen avatar Sep 07 '23 06:09 alikulaOwen