read() does not read whole file in activepython/DOS

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Holger

    #1

    read() does not read whole file in activepython/DOS

    This is what it looks like in DOS:
    =============== =============== =========
    C:\production>p ython
    ActivePython 2.5.2.2 (ActiveState Software Inc.) based on
    Python 2.5.2 (r252:60911, Mar 27 2008, 17:57:18) [MSC v.1310 32 bit
    (Intel)] on
    win32
    Type "help", "copyright" , "credits" or "license" for more information.
    >>b = open('boot.bin' ).read()
    >>len(b)
    1067
    >>import os
    >>os.path.getsi ze('boot.bin')
    18308L
    =============== =============== =========

    And this is what is says in cygwin:
    =============== =============== =========
    $ python
    Python 2.5.1 (r251:54863, May 18 2007, 16:56:43)
    [GCC 3.4.4 (cygming special, gdc 0.12, using dmd 0.125)] on cygwin
    Type "help", "copyright" , "credits" or "license" for more information.
    >>b = open('boot.bin' ).read()
    >>len(b)
    18308
    >>import os
    >>os.path.getsi ze('boot.bin')
    18308L
    =============== =============== =========

    What is wrong? / What am I doing wrong?
    I would expect it to read the whole file.

    Help appreciated :-)
    Holger
  • Holger

    #2
    Re: read() does not read whole file in activepython/DOS

    On Nov 7, 2:40 pm, Holger <ish...@gmail.c omwrote:
    This is what it looks like in DOS:
    =============== =============== =========
    C:\production>p ython
    ActivePython 2.5.2.2 (ActiveState Software Inc.) based on
    Python 2.5.2 (r252:60911, Mar 27 2008, 17:57:18) [MSC v.1310 32 bit
    (Intel)] on
    win32
    Type "help", "copyright" , "credits" or "license" for more information.>>> b = open('boot.bin' ).read()
    >len(b)
    1067
    >import os
    >os.path.getsiz e('boot.bin')
    >
    18308L
    =============== =============== =========
    >
    What is wrong? / What am I doing wrong?
    I would expect it to read the whole file.
    Solution: open(<file>, 'rb')

    Comment

    Working...