[Python-Dev] Unicode decode exception (original) (raw)
Bruno Cauet brunocauet at gmail.com
Sun Nov 30 17🔞46 CET 2014
- Previous message: [Python-Dev] Unicode decode exception
- Next message: [Python-Dev] Unicode decode exception
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Did you try opening it as a binary file? open(filename, 'rb'):
— Tagada tsouin tsouin
On Sun, Nov 30, 2014 at 5:06 PM, balaji marisetti <balajimarisetti at gmail.com> wrote:
Hi, When I try to iterate through the lines of a file("openssl-1.0.1j/crypto/bn/asm/x8664-gcc.c"), I get a UnicodeDecodeError (in python 3.4.0 on Ubuntu 14.04). But there is no such error with python 2.7.6. What could be the problem? In [39]: with open("openssl-1.0.1j/crypto/bn/asm/x8664-gcc.c") as f: for line in f: print (line) --------------------------------------------------------------------------- UnicodeDecodeError Traceback (most recent call last) in () 1 with open("../openssl-1.0.1j/crypto/bn/asm/x8664-gcc.c") as f: ----> 2 for line in f: 3 print (line) 4 /usr/lib/python3.4/codecs.py in decode(self, input, final) 311 # decode input (taking the buffer into account) 312 data = self.buffer + input --> 313 (result, consumed) = self.bufferdecode(data, self.errors, final) 314 # keep undecoded input until the next call 315 self.buffer = data[consumed:] -- :-)balaji
Python-Dev mailing list Python-Dev at python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/brunocauet%40gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20141130/ec2f861c/attachment.html>
- Previous message: [Python-Dev] Unicode decode exception
- Next message: [Python-Dev] Unicode decode exception
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]