Try:
import ConfigParser
import os
config = ConfigParser.ConfigParser()
config.read(os.path.join(os.path.dirname(__file__), r"config.ini"))
usernameA = config.get("sectionA", "username")
dirname
: returns the directory of a file.
__file__
: refers to the script file name