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

Only supports reading a file from the filesystem #25

Open
maackle opened this issue Oct 9, 2017 · 5 comments
Open

Only supports reading a file from the filesystem #25

maackle opened this issue Oct 9, 2017 · 5 comments

Comments

@maackle
Copy link

maackle commented Oct 9, 2017

It would be great if the API would take file-like objects as input, rather than a string to the file path. In my case, I load DBF file data directly from an API into a io.BytesIO object and want to operate on that data directly. To use dbfread I'd have to save it to a temp file.

@rysson
Copy link

rysson commented May 30, 2018

Hi,

It's necessary form me too. I've created simple patch:
rysson@ae3162d

File-like object is used directly if seek-able. If not, io.BytesIO is used.

Now you can:

with zipfile.ZipFile('/path/to/file.zip', 'r') as zf:
    with zf.open('BAZA/ZESPOLY.DBF') as z:
         for record in DBF(z):
             print(record)

BTW. Next commit adds code page 'mazovia' support.

@olemb, could you give me a comment? Can i create pull-request?

@razor-1
Copy link

razor-1 commented Nov 13, 2019

Looks like this project may be abandoned? Would be great to get this in

@ptvirgo
Copy link

ptvirgo commented Apr 20, 2020

... and third. @rysson not sure if you can get a pull request accepted, but it's exactly what I need.

@olemb
Copy link
Owner

olemb commented Dec 21, 2020

... and fourth.

I am very sorry that I had to abandon the project for a long time time for reasons I won't go into here (in short, life happened), but I am starting up again now and this is at the top of the list of new features to add. It's very highly requested and would be useful in a lot of different situations.

Since there are now several issues pull requests I've made a meta-issue #53 where we can discuss the pros and cons of the different implementations.

I will have to read the code and discussions on each issue before I'm ready to give any informed answers.

(Edit: forgot to add the issue number.)

@zaneselvans
Copy link

We created a fork over here that does some of this, if it's useful to you at all: https://github.com/catalyst-cooperative/dbfread

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

6 participants