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

Support File-like objects instead of just path strings #33

Closed
j6k4m8 opened this issue Jun 3, 2020 · 2 comments
Closed

Support File-like objects instead of just path strings #33

j6k4m8 opened this issue Jun 3, 2020 · 2 comments
Labels
enhancement New feature or request wontfix This will not be worked on

Comments

@j6k4m8
Copy link

j6k4m8 commented Jun 3, 2020

I would love to be able to pass a python File object (with read interfaces etc) rather than just a file on disk: I sometimes have these files in RAM and can't currently read them. It seems to me that this would be a pretty simple fix here but is there something I'm missing?

@ofajardo
Copy link
Owner

ofajardo commented Jun 3, 2020

Unfortunately it's not that easy: the underlying C library librdata takes only a file on disk. The line you suggest is only a check, because if something which is not a path is passed downstream an error arises, therefore removing it doesn't fix anything.

The only way is to change the C library first. You can submit an issue to librdata if you like, if they do the change, I adapt pyreadr to accommodate it.

Such a change however is not trivial as it may break applications depending on the C library. A similar thing has been proposed for a similar library Readstat and the pull request is stale since a more than one year (WizardMac/ReadStat#179).

For the time being please save those files to disk and then process them.

@ofajardo ofajardo added the enhancement New feature or request label Jun 3, 2020
@j6k4m8
Copy link
Author

j6k4m8 commented Jun 3, 2020

Got it — thank you for the clear explanation! Happy to close this issue if you'd like :)

@ofajardo ofajardo added the wontfix This will not be worked on label Jun 6, 2020
@j6k4m8 j6k4m8 closed this as completed Nov 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants