New submission from Thomas Courbon <hart...@yahoo.fr>:

When ran in python 3.1.1 (hand compiled, fedora 11), the first example
of configparser module fail with :
Traceback (most recent call last):
  File "test1.py", line 22, in <module>
    config.write(configfile)
  File "/usr/local/lib/python3.1/configparser.py", line 394, in write
    fp.write("[%s]\n" % section)
TypeError: write() argument 1 must be bytes or buffer, not str

This can be solved by replacing :
with open('example.cfg', 'wb') as configfile:

by :
with open('example.cfg', 'w') as configfile:

Patch attached.

Cheer !
Thomas

----------
assignee: georg.brandl
components: Documentation
messages: 93858
nosy: georg.brandl, tcourbon
severity: normal
status: open
title: Error in config parser example (w/ Patch)
versions: Python 3.1

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue7103>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to