Setting path for .matplotlibrc

I have several programs that run as daemons which run with different unix ids. each of the unix ids share the same user home dir. They are now failing with the following error:

Traceback (most recent call last):
  File "StartScanDaemon.py", line 69, in ?
    main(sys.argv)
  File "StartScanDaemon.py", line 61, in main
    from scheduler.Scheduler import Scheduler
  File "../scheduler/Scheduler.py", line 24, in ?
    from peak.util.imports import lazyModule
  File "/usr/lib/python2.4/site-packages/Importing-1.9.1-py2.4.egg/peak/__init__.py", line 1, in ?
    __import__('pkg_resources').declare_namespace(__name__)
  File "/usr/lib/python2.4/site-packages/setuptools-0.6a9-py2.4.egg/pkg_resources.py", line 2212, in ?
    add_activation_listener(lambda dist: dist.activate())
  File "/usr/lib/python2.4/site-packages/setuptools-0.6a9-py2.4.egg/pkg_resources.py", line 517, in subscribe
    callback(dist)
  File "/usr/lib/python2.4/site-packages/setuptools-0.6a9-py2.4.egg/pkg_resources.py", line 2212, in <lambda>
    add_activation_listener(lambda dist: dist.activate())
  File "/usr/lib/python2.4/site-packages/setuptools-0.6a9-py2.4.egg/pkg_resources.py", line 1843, in activate
    map(declare_namespace, self._get_metadata('namespace_packages.txt'))
  File "/usr/lib/python2.4/site-packages/setuptools-0.6a9-py2.4.egg/pkg_resources.py", line 1447, in declare_namespace
    declare_namespace(parent)
  File "/usr/lib/python2.4/site-packages/setuptools-0.6a9-py2.4.egg/pkg_resources.py", line 1462, in declare_namespace
    _handle_ns(packageName, path_item)
  File "/usr/lib/python2.4/site-packages/setuptools-0.6a9-py2.4.egg/pkg_resources.py", line 1433, in _handle_ns
    loader.load_module(packageName); module.__path__ = path
  File "/usr/lib/python2.4/site-packages/setuptools-0.6a9-py2.4.egg/pkg_resources.py", line 1262, in load_module
    mod = imp.load_module(fullname, self.file, self.filename, self.etc)
  File "/usr/lib/python2.4/site-packages/matplotlib-0.87.2-py2.4-linux-i686.egg/matplotlib/__init__.py", line 999, in ?
    rcParams = rc_params()
  File "/usr/lib/python2.4/site-packages/matplotlib-0.87.2-py2.4-linux-i686.egg/matplotlib/__init__.py", line 956, in rc_params
    fname = matplotlib_fname()
  File "/usr/lib/python2.4/site-packages/matplotlib-0.87.2-py2.4-linux-i686.egg/matplotlib/__init__.py", line 902, in matplotlib_fname
    fname = os.path.join(get_configdir(), 'matplotlibrc')
  File "/usr/lib/python2.4/site-packages/matplotlib-0.87.2-py2.4-linux-i686.egg/matplotlib/__init__.py", line 273, in wrapper
    ret = func(*args, **kwargs)
  File "/usr/lib/python2.4/site-packages/matplotlib-0.87.2-py2.4-linux-i686.egg/matplotlib/__init__.py", line 329, in _get_configdir
    os.mkdir(p)
OSError: [Errno 17] File exists: '/home/userhomedir/.matplotlib'

I tried to set the env variable:

os.environ["MATPLOTLIBRC"] = ApplicationConfig.server.serviceid

before loading maplotlib

before loading matplotlib but that does not work. Any ideas on what I'm doing wrong?

Thanks,

Vineet