Original report by Klaus Alexander Seistrup (Bitbucket: kseistrup, GitHub: kseistrup).
Standing in a directory with a setup.cfg file, using python2.7:
#!python
>>> import configparser
>>> parser=configparser.ConfigParser()
>>> parser.read('setup.cfg')
[]
>>> parser.read(u'setup.cfg')
[u'setup.cfg']
>>>
So if there accidentally is a file byt the name of s, e, t, u, p, c, f, or g, that file will be read:
#!python
$ ln -s setup.cfg s
$ python2.7
>>> import configparser
>>> parser=configparser.ConfigParser()
>>> parser.read('setup.cfg')
['s']
>>>
Hint: ConfigParser()'s .read() method says that the filename should only be included in the file list if the name is a unicode instance, and thus a plain string object gets treated as a list.
Original report by Klaus Alexander Seistrup (Bitbucket: kseistrup, GitHub: kseistrup).
Standing in a directory with a setup.cfg file, using python2.7:
So if there accidentally is a file byt the name of s, e, t, u, p, c, f, or g, that file will be read:
Hint: ConfigParser()'s .read() method says that the filename should only be included in the file list if the name is a unicode instance, and thus a plain string object gets treated as a list.