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 for loading open file pointers / gzip file pointers #11

Open
GoogleCodeExporter opened this issue Oct 3, 2015 · 1 comment
Open

Comments

@GoogleCodeExporter
Copy link

Hi,

I recently had the need for loading gzipped arff files and added the following 
code to allow file objects (such as those returned by gzip.open) to be directly 
parsed.

Here is the patch for arff/__init__.py:

237,240d236
< # Responsibility for closing fobj is left to the caller
< def load_file_object(fobj):
<     for item in Reader(fobj):
<         yield item
244c240,242
<         load_file_object(fhand)

---
>         for item in Reader(fhand):
>             yield item
> 

Original issue reported on code.google.com by HerrKe...@gmail.com on 7 Dec 2013 at 5:40

@GoogleCodeExporter
Copy link
Author

My above patch doesn't work on some versions of python. I therefore recommend 
the following patch, which just duplicates a bit of code:

237,240d236
< # Responsibility for closing fobj is left to the caller
< def load_file_object(fobj):
<     for item in Reader(fobj):
<         yield item

Original comment by HerrKe...@gmail.com on 13 Dec 2013 at 10:00

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant