Parsing error for ConfigParser

Andrew Z. ahz001 at gmail.com
Thu Sep 23 19:22:33 CEST 2010


Is there a way to parse RealPlayer's realplayerrc in Python?  I need
to support Python 2.5 - 2.7

Example code

import urllib2
import ConfigParser
f = urllib2.urlopen('http://pastebin.com/download.php?i=N1AcUg3w')
config = ConfigParser.RawConfigParser()
config.readfp(f)


Error
Traceback (most recent call last):
  File "test_config_parser_real_player.py", line 6, in <module>
    config.readfp(f)
  File "/usr/lib/python2.6/ConfigParser.py", line 305, in readfp
    self._read(fp, filename)
  File "/usr/lib/python2.6/ConfigParser.py", line 510, in _read
    raise e
ConfigParser.ParsingError: File contains parsing errors: <???>
        [line 31]: '%0aCopyright (c) 1995-2000 Macromedia, Inc. All
rights reserved.\r\n'
        [line 34]: '%0a\r\n'



More information about the Python-list mailing list