This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author exe
Recipients exe
Date 2009-09-22.13:45:07
SpamBayes Score 3.476227e-10
Marked as misclassified No
Message-id <1253627111.3.0.369651461039.issue6969@psf.upfronthosting.co.za>
In-reply-to
Content
Hello! Seems configparser is broken in recent versions of py3k. Please also check older 
versions of python.

$ python3 ./cfgexample.py 
Traceback (most recent call last):
  File "./cfgexample.py", line 9, in <module>
    config.write(configfile)
  File "/usr/local/py3k/lib/python3.2/configparser.py", line 394, in write
    fp.write("[%s]\n" % section)
TypeError: must be bytes or buffer, not str
$ cat ./cfgexample.py 
import configparser

config = configparser.RawConfigParser()

config.add_section('Section1')
config.set('Section1', 'int', '15')

with open('example.cfg', 'wb') as configfile:
    config.write(configfile)
$ python3 --version
Python 3.2a0


I've built this version of python:
$ hg head
changeset:   4765:488e143fad23
branch:      py3k
tag:         tip
user:        tarek.ziade
date:        Tue Sep 22 12:08:13 2009 +0200
summary:     [svn r75013] Merged revisions 74812 via svnmerge from
History
Date User Action Args
2009-09-22 13:45:11exesetrecipients: + exe
2009-09-22 13:45:11exesetmessageid: <1253627111.3.0.369651461039.issue6969@psf.upfronthosting.co.za>
2009-09-22 13:45:09exelinkissue6969 messages
2009-09-22 13:45:07execreate