Bugs item #1586513, was opened at 2006-10-28 21:56
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1586513&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Shaun Cutts (shauncutts)
Assigned to: Nobody/Anonymous (nobody)
Summary: codecs.open problem with "with" statement

Initial Comment:
Codecs.open does not seem to properly support the
"with" protocol. Using codecs.open with "with" and
without "with" hill give different results in a simple
test.

-----------------------------------------
from __future__ import with_statement
import codecs

fn = 'test.txt'
f = open( fn, 'w' )
f.write( '\xc5' )
f.close()


f = codecs.open( fn, 'r', 'L1' )
print repr( f.read() )
f.close()

with codecs.open( fn, 'r', 'L1' ) as f:
    print repr( f.read() )
---------------------------------------
output:
---------------------------------------
u'\xc5'
'\xc5'
---------------------------------------
Note: 2nd string not unicode.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1586513&group_id=5470
_______________________________________________
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to