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.

classification
Title: Error in config parser example (w/ Patch)
Type: behavior Stage: resolved
Components: Documentation Versions: Python 3.1
process
Status: closed Resolution: out of date
Dependencies: Superseder: configparser
View: 6969
Assigned To: ezio.melotti Nosy List: ezio.melotti, georg.brandl, r.david.murray, tcourbon
Priority: low Keywords: patch

Created on 2009-10-11 13:09 by tcourbon, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
configparser_example_issue_7103.patch tcourbon, 2009-10-11 13:13 Patch.
Messages (4)
msg93858 - (view) Author: Thomas Courbon (tcourbon) Date: 2009-10-11 13:09
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
msg93871 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2009-10-11 19:24
This is a duplicate of issue 6969, where it has been fixed.
msg93877 - (view) Author: Thomas Courbon (tcourbon) Date: 2009-10-11 21:32
Due to its quite generic title I was unable to find this issue.
Sorry for the duplicate.

Thomas
msg93878 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2009-10-11 21:37
Yes, no blame attaches to you, and thanks for the report.  (_I_ had
trouble finding the issue and I remembered that it existed.)
History
Date User Action Args
2022-04-11 14:56:53adminsetgithub: 51352
2009-10-11 21:37:27r.david.murraysetmessages: + msg93878
2009-10-11 21:32:23tcourbonsetmessages: + msg93877
2009-10-11 19:24:08r.david.murraysetstatus: open -> closed

superseder: configparser
type: behavior

nosy: + r.david.murray
messages: + msg93871
resolution: out of date
stage: resolved
2009-10-11 16:19:19ezio.melottisetpriority: low
assignee: georg.brandl -> ezio.melotti

nosy: + ezio.melotti
2009-10-11 13:13:15tcourbonsetfiles: + configparser_example_issue_7103.patch
keywords: + patch
2009-10-11 13:09:34tcourboncreate