file's tell() method appears crazily broken (2.0)

Bengt Richter bokr at
Sun Jan 27 18:21:24 CET 2002

On Sun, 27 Jan 2002 15:02:00 GMT, "Steve  Holden" <sholden at> wrote:

>Sorry if this is an old error, I couldn't find anything on SourceForge. I'd
>really like to know if it's repeatable in other environments.
>I cam across this when the rfc822 library failed reading a file containing a
>newsgroup post. Some debugging led me to a really simple program which
>exhibits the same error:
>import sys
>fp = open(sys.argv[1], "r")
>print "File open at", fp.tell()

I'd guess you need "rb" for tell to work properly on non-unix platforms.

Still, an informative error message from tell might be nice if it knows
what's happening.

Bengt Richter

More information about the Python-list mailing list