ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> python-list
python-list
What is the correct way to port codecs.open to python 3.1?
by Baptiste Lepilleur other posts by this author
Nov 7 2009 4:00AM messages near this date
ErrorHandler 1.1.0 Released! | Re: What is the correct way to port codecs.open to python 3.1?
After applying 2to3.py to port a 2.6 script to 3.1, I get the following
error when running my script:
  File "purekeyworddbtest.py", line 143, in __init__
    f = codecs.open(EXCLUDED_KEYWORDS_FILE, 'rt', 'utf-8')
  File "c:\Python31\lib\codecs.py", line 870, in open
    file = builtins.open(filename, mode, buffering)
ValueError: can't have text and binary mode at once

I skimmed through python 3.0 release notes, and I haven't seen anything
indicating that codecs.open behaviour has changed in incompatible way (just
that it is no longer useful). Have I missed something?

Do I need to replace all codecs.open with the built-in open function? If so,
why does codecs.open still exist?
Thread:
Baptiste Lepilleur
Mrab
Antoine Pitrou
Baptiste Lepilleur

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved