New submission from Mickey Ju <[email protected]>:
If this issue has raised previously, then I am sorry for repeating. I did a
search but did not find related reports.
Below is the thing I did.
config = configparser.RawConfigParser()
#config.read_file(urlopen(path_config))
config.read_file(open('jkl.ini', 'rb'))
The line commented out was the thing I wanted to do originally. I wanted to
parse a configuration file stored on some web server. And I got this error
"TypeError: startswith first arg must be bytes or a tuple of bytes, not str."
But after I tried, with this line "config.read_file(open('jkl.ini', 'rb'))",
the same error can be reproduced. Therefore, I think the error message should
be stated another way around as "startswith first arg must be str instead of
bytes or a tuple of bytes." I have checked this by adding the lines below to
configparser.py after the for-loop at line 994.
print(type(line))
line = str(line, 'utf-8')
print(type(line))
That made the code work.
----------
components: Build
messages: 148747
nosy: mickeyju
priority: normal
severity: normal
status: open
title: configparser
type: behavior
versions: Python 3.2
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue13518>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com