View Single Post
Old 04-28-2011, 02:20 PM   #194
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,499
Karma: 8065348
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
The problem is the file(xxx).read(). That is opening the file in text mode, not binary mode. The read is finding a ^Z, which is end of file. The difference between binary and text mode is one of the silliest things that MS ever did.

Use something like
Code:
handle = open(filename, 'rb')
content = handle.read()
handle.close()
chaley is offline   Reply With Quote