question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`fromfile` should raise an exception if not passed a “low-level file”

See original GitHub issue

An ancient ticket from 2007 notes that fromfile does not work with files opened with gzip. Instead, it will interpret the literal gzip data. This is due to the fundamental way fromfile works and the resolution of the bug was essentially wontfix.

Secondly, it should be made clear in the documentation that you cannot pass a GzipFile. Some file-like objects trigger io.UnsupportedOperation.

It may save bugs and headaches if fromfile were to raise an Exception if it is passed a file-object that is not a low-level file.

Issue Analytics

  • State:open
  • Created 7 years ago
  • Reactions:1
  • Comments:20 (16 by maintainers)

github_iconTop GitHub Comments

2reactions
jzwinckcommented, Dec 1, 2017

Is there any reason not to implement this so it actually works? It’s been ten years since the bug was initially reported, and it’s still hurting people–for example https://stackoverflow.com/questions/47574607/python-gzip-module-doesnt-work-as-expected-on-ubyte-file/

It seems to me that it is possible to implement np.fromfile() so that it works with GzipFile (but not using readinto()).

1reaction
eric-wiesercommented, May 7, 2019

I think I agree with the consensus here that we should probably reopen this. Since closed issues are hard to rediscover, I’m going to reopen it for now - we can always close it again if another maintainer wants to argue strongly for it.

For every ancient issue we close with opposition, there are 10 which are unreproducible/irrelevant/already fixed - so it’s easy to be overzealous with closing,

Sometimes I wish we had fewer APIs for serialization / deserialization, especially for text formats…

Read more comments on GitHub >

github_iconTop Results From Across the Web

The GNU C Library - Documentation
This happens transparently for the user since all of the lowlevel file handling functions are equally replaced. This function is a cancellation point...
Read more >
The GNU C Library - ftp://ftp.gnu.org
This happens transparently for the user since all of the lowlevel file handling functions are equally replaced. This function is a cancellation point...
Read more >
Python Pocket Reference 978-1449357016 - DOKUMEN.PUB
Indicates that anything else on the command line is passed to the script file or ... Intended for lowlevel file tasks only; not...
Read more >
Hack7 Section 4 | PDF | Division (Mathematics) | Class (Computer ...
FCREATE() creates a file on disk, and returns a "handle"a numeric value that other lowlevel file functions must have to refer to the...
Read more >
capsule.txt - ftpmirror.your.org
[CP/M-80:BDS] If the two files are not the same length, FILECOMP will ... Routines to do lowlevel file l/O. Includes functions to seek,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found