xport
xport copied to clipboard
Improve error message when trying to open a CPORT file
Hello, thank you for this amazing package! I think I do require an update for version 8 XPORT. I am trying to download a file from cms and load it into a data frame, but I am unable to do so. I receive this error: ValueError: Document does not match SAS Version 5 or 6 Transport (XPORT) format right now I am using version 3.5.0
@cmdugan13 Do you mind pasting the code you used?
I should probably improve the README. Did you use xport.v89.load
?
I don't, so it could be a version problem since it doesn't even show up in the directory ['Dataset', 'DictReader', ...... 'to_numpy', 'to_rows', 'v56', 'warnings']
Will check on that.
Edit: version 3.5.0
Thanks for pointing that out. Please import xport.v89
.
I made sure the version was upgraded, do it solved the missing module issue. I am back to receiving the ValueError: Document does not match SAS Version 5 or 6 Transport (XPORT) format error, though.
import xport.v89
with open('C2419P1M.XPORT', 'rb') as f:
library = xport.v89.load(f)
Is this related to https://github.com/selik/xport/issues/6
Rats. Seems like a bug. Could you share the result of f.read(800)
? I'd like to see the header bytes of the file.
Oh, if this is a CPORT file, then it's not yet supported, but the error message should be better.