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 mickeyju
Recipients mickeyju
Date 2011-12-01.23:42:55
SpamBayes Score 3.2682987e-05
Marked as misclassified No
Message-id <1322782976.1.0.275624635723.issue13518@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2011-12-01 23:42:56mickeyjusetrecipients: + mickeyju
2011-12-01 23:42:56mickeyjusetmessageid: <1322782976.1.0.275624635723.issue13518@psf.upfronthosting.co.za>
2011-12-01 23:42:55mickeyjulinkissue13518 messages
2011-12-01 23:42:55mickeyjucreate