Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve error message when trying to open a CPORT file #86

Open
cmdugan13 opened this issue Jan 18, 2022 · 7 comments
Open

Improve error message when trying to open a CPORT file #86

cmdugan13 opened this issue Jan 18, 2022 · 7 comments

Comments

@cmdugan13
Copy link

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

@selik
Copy link
Owner

selik commented Jan 19, 2022

@cmdugan13 Do you mind pasting the code you used?

@selik
Copy link
Owner

selik commented Jan 19, 2022

I should probably improve the README. Did you use xport.v89.load?

@cmdugan13
Copy link
Author

cmdugan13 commented Jan 19, 2022

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

@selik
Copy link
Owner

selik commented Jan 19, 2022

Thanks for pointing that out. Please import xport.v89.

@cmdugan13
Copy link
Author

cmdugan13 commented Jan 19, 2022

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 #6

@selik
Copy link
Owner

selik commented Jan 19, 2022

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.

@selik
Copy link
Owner

selik commented Jan 19, 2022

Oh, if this is a CPORT file, then it's not yet supported, but the error message should be better.

@selik selik changed the title Need update to include version 8 Improve error message when trying to open a CPORT file Feb 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants