python configparser

it took me quite a while to figure out why the code below

from ConfigParser import ConfigParser
conf = ConfigParser()
conf.read(...)

was working in one codebase but not working in another codebase.

Turns out the package renamed to lower case (probably backward compatibility is never a concern in python ecosystem) in python3.

so above code worked for python 2, need to change to below for python 3

from configparser import ConfigParser
conf = ConfigParser()
conf.read(...)

(wondering how python ecosystem would look like if there is a version 4/5 in future).

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s