Message148747
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. |
|
Date |
User |
Action |
Args |
2011-12-01 23:42:56 | mickeyju | set | recipients:
+ mickeyju |
2011-12-01 23:42:56 | mickeyju | set | messageid: <1322782976.1.0.275624635723.issue13518@psf.upfronthosting.co.za> |
2011-12-01 23:42:55 | mickeyju | link | issue13518 messages |
2011-12-01 23:42:55 | mickeyju | create | |
|