Closed elisandrom closed 7 months ago
I'll need enough information to recreate the issue. If possible provide desensitised data that causes the issue. If parsing DE55 is the issue, then I would need the full DE55 element.
I'll need enough information to recreate the issue. If possible provide desensitised data that causes the issue. If parsing DE55 is the issue, then I would need the full DE55 element.
I sent you the DE55 example in your email.
I have added some additional debugging statements to the master branch. If you could rerun after installing from source and send me the debug messages, I'll be able to see what is causing the issue and work out next steps.
pip install git+https://github.com/adelosa/cardutil
Thanks for reporting the issue and providing the debug information. I have now been able to recreate the issue.
The issue is that the function that converts the data to the required ISO format did not expect to process a bytes based field. Generally all fields in the dict are not bytes... except DE55, the ICC field which is a binary field. I will be pushing an update so that it leaves the byte field as is rather than formatting it.
If you find fields missing in the output, it's probably because of the use of both PDS and DE fields in the conversion. See warning in https://adelosa.github.io/cardutil/cli.html#mci-csv-to-ipm. The encode function you are using first goes from iso to python dict which will contain both DE and PDS fields and then send the result to dict to iso which will be impacted by this constraint. You can strip PDS fields being output via a custom configuration (remove the field processors = PDS)
Will push a new commit shortly to master branch - you can test it to ensure it resolves your issue and let me know. I will then push out a new minor release of the tool.
The CLI does not have a custom bit config option. I have updated the CLI to strip any PDS field processors to ensure you don't hit any issues with the encode. Let me know how you go.
Hello, I will only be able to test it on Tuesday. As soon as I have the results I will let you know. thank you very much!
Hello, I updated cardutil here to the latest version and using the same T112 file, it still gives the error, is it something I still need to change?
mci_ipm_encode T112_T -o T112_T_ASC --in-format 1014 --out-format 1014 --in-encoding cp500 --out-encoding latin_1 --debug
File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\cardutil\iso8583.py", line 275, in _field_to_iso8583
output += format(field_value[:field_length], '<' + str(field_length))
TypeError: unsupported format string passed to bytes.__format__
Did you install from source? I have not updated the release yet. Use 'pip install git+https://github.com/adelosa/cardutil'
Yes, I did it using that same command.
The error indicates line 275 of iso8583.py The code in master is different than what is displayed in your error. If you already have the cardutil package installed make sure you use the --upgrade --force-reinstall options with pip.
Hi, now everything works using--in-format 1014 --out-format 1014 --in-encoding cp500 --out-encoding latin_1
, thank you very much for your help.
The goal was to use: --in-format 1014 --out-format 1014 --in-encoding cp500 --out-encoding latin_1
this worked perfectly now.
I tested --in-format 1014 --out-format vbs --in-encoding cp500 --out-encoding latin_1
and it returns an error but in other places, if you want to look, you can see it in the same test file that I sent .
But if you wish, we can close this Issue, since the problem of DE55 has been resolved.
Happy to have a look at that. If you can send me debug details that would be great (here or email). I'll push a release for this fix and raise a new issue for format conversion.
Thanks for the test file. Was able to recreate the second issue and fixed it. Seems I had the input and output formats mixed up on the CLI command - so input was output and vice versa. Fixed and rerun - working now. Will push out a release shortly.
Release 0.6.4 has fixes for both the issues identified.
Execution Parameters:
mci_ipm_encode T112 -o T112_T --in-format 1014 --out-format 1014 --in-encoding cp500 --out-encoding latin_1 --debug
Error:
What can be adjusted? Thanks!