I am reading EXE (size 2 MB) which have some ASCII text too. Trying to retrieve data as per matched conditions. In Python 2.6, following code is working fine (give me result in 2 sec) but not in 3.2. In Python 3.2 , it keep running forever no response.
Thanks...
match_str = b"sape"
out= ""
try:
file_obj = open(exe_filePath,'rb')
while 1:
data = file_obj.readline(100)
if data.count(match_str) > 0:
out = data.strip()[9:13]
if data=="":
break
file_obj.close()
return out
except:
file_obj.close()
raise "Some error occurred"