Fixing fromfile to throw error when opening on gzip files

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Fixing fromfile to throw error when opening on gzip files

Sidhant Bansal
In regard to the issue: https://github.com/numpy/numpy/issues/7713
And my corresponding PR: https://github.com/numpy/numpy/pull/16221

I was advised to put this on the mailing list to get a general sense of how the issue is affecting people and to discuss how I can improve the current PR.

I am still interested in resolving this issue, so will be glad to do some re-work to be able to get this merged and fix the issue.

The currently proposed PR is a kind of band-aid solution which uses an if-else chunk in the `fromfile` function's internal implementation to catch if the file opened is gzip type or not and throws an error.

The drawback lies in the fact that we only are able to resolve gzip type issue and is not extendable to other high level file types which cant be opened.

In my findings, I was unable to find a common distinguishing feature for those file types which cannot be opened using fromfile vs those which can be (ex. In a hypothetical situation one kind has the read method and other doesn't).

Would love to hear what other people think and if they have any inputs about the what possible common distinguishing features can be there or if we should simply cross-check the file type against a hard-coded list of common high-level file types?

Sidhant.

_______________________________________________
NumPy-Discussion mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/numpy-discussion