wizardofzos / pyracf

RACF parsing for the rest of us...
Apache License 2.0
7 stars 8 forks source link

parse fails when input unload file has garbage at the end #38

Closed rob-vh closed 1 month ago

rob-vh commented 1 month ago

unload file has x'001a' (CTRL-Z) at the end after file transfer, and parse_t() tries to find the layout of the record for record type x'001a'. This results in KeyError, obviously:

File "/pyracf-dev-0.9/src/pyracf/__init__.py", line 324, in parse_t
    offsets = RACF._recordtype_info[r]["offsets"]
KeyError: '\x1a'

We need to check if r in RACF._recordtype_info, or add a try:

rob-vh commented 1 month ago

Solved with fix in 0.9. in def parse_t(): change if not thingswewant or r in thingswewant: into if r in RACF._recordtype_info and (not thingswewant or r in thingswewant):