Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'f.close()': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:module': 0.09; 'subject:using': 0.09; 'python': 0.11; 'def': 0.12; 'advance!': 0.16; 'hex': 0.16; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:plane.gmane.org': 0.16; 'received:t-ipconnect.de': 0.16; 'subject:File': 0.16; 'subject:issue': 0.16; 'wrote:': 0.18; 'import': 0.22; 'shell': 0.22; 'this?': 0.23; 'header:User- Agent:1': 0.23; 'header:X-Complaints-To:1': 0.27; 'skip:( 20': 0.30; 'code': 0.31; 'run': 0.32; 'skip:# 10': 0.33; 'skip:o 20': 0.38; 'thank': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'tell': 0.60; 'become': 0.64 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Peter Otten <__peter__@web.de> Subject: Re: File Read issue by using module binascii Date: Sat, 27 Apr 2013 12:57:09 +0200 Organization: None References: <9b5795ab-baec-4c0a-a3b4-1075cffc8744@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7Bit X-Gmane-NNTP-Posting-Host: p508489b0.dip0.t-ipconnect.de User-Agent: KNode/4.7.3 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 21 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1367060234 news.xs4all.nl 15891 [2001:888:2000:d::a6]:57701 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:44444 Jimmie He wrote: > When I run the readbmp on an example.bmp(about 100k),the Shell is become > to "No respose",when I change f.read() to f.read(1000),it is ok,could > someone tell me the excat reason for this? Thank you in advance! > > Python Code as below!! > > import binascii > > def read_bmp(): > f = open('example.bmp','rb') > rawdata = f.read() #f.read(1000) is ok > hexstr = binascii.b2a_hex(rawdata) #Get an HEX number > bsstr = bin (int(hexstr,16))[2:] > f.close() > print('bin: ',bsstr,type(bsstr)) > return What shell are you using? The one provided by Idle?