Hi all!

I need to be able to use a custom Config.prc (not the one in the Panda directory), since I want to version control it, so that I can use my custom configuration no matter where I go.

My Eclipse and Netbeans projects, in conjunction with my Python sources are not located in the Panda directory.

I tried placing Config.prc in the same directory as my main module, and also in its own “etc” directory but when I run my module it keeps using Panda’s default Config.prc.

What can I do about it?


You can set the environment variable PANDA_PRC_DIR to the name of the directory that contains your Config.prc file.

You can also set PANDA_PRC_PATH to a list of directories, separated by a semicolon (on Windows) or a colon (on Mac or Linux) that should be searched.


Thanks for the info!


i do it the following way:

from pandac.PandaModules import loadPrcFile
configfiles = ["/etc/gameconfig.prc", "etc/gameconfig.prc"]
for prc in configfiles:

path syntax is the same as when loading assets, IIRC.

Hi all!

I’m trying to load only my custom Config.prc file by following the suggestions in this thread (that I started), and by looking at other posts.

I’ve called loadPrcFile() before importing directstart and I’ve printed cpMgr getting the following results:

1 explicit pages:

2 implicit pages:

My question is the following: is there any way to completely ignore implicit pages?

I want that my custom Config.prc is the only one being loaded, since in my project I have various executable modules (i.e tools), and I need each one to have its own configuration.


The implicit files are loaded based on the settings of $PANDA_PRC_DIR and $PANDA_PRC_PATH at the time the application is started. If you don’t want any of these default files loaded, you can ensure that these variables are set to your own directory instead of the system location.

Note also that most config variables will be shadowed normally by the values you define in your own files. So if there’s a particular config setting that you’re picking up from the system config file, you can simply define that same variable to your intended setting in your local config file, and it will have that setting instead of the system setting.


Thanks David for the answer…

I tried looking for those environment variables in my PC, but couldn’t find them under MyPc, Properties, Advanced Options, Environment variables.

So I added the following code before importing directstart.

import os
os.environ["PANDA_PRC_DIR"] = os.getcwd()
os.environ["PANDA_PRC_PATH"] = os.getcwd()

It now works exactly as I wanted! The only thing I have to do is make sure to have Config.prc and Confauto.prc in the same directory where my main executable script is.

One question though, setting the environment variables in this way (by using os.getcwd()), will work on all operating systems (I’m working on Windows XP)?

Since Panda did not gave me any error I assume it does…


Sure, that’s a fine solution, and platform-independent.


sorry to reopen a solved thread, but here setting the environment variables seems to have zero result. whatever i set there, it always falls back to /opt/panda3d/etc, which is the builtin installation path.

unfortunately i have no other OS/computer for testing here and setting all output to highest verbosity also gave absolutely no info about what config files had been loaded or why.

cpMgr gives me only the implicit pages, btw.

I’m using GNU/Linux (Archlinux) with a custom, week-old panda build

Depending on your panda build, the environment variables might be $PRC_DIR and $PRC_PATH.

You can also print cpMgr.getSearchPath(); that might provide some insight.


If you’re using a makepanda build and didn’t modify the makepanda script itself to change the default variables, it should be PANDA_PRC_*.

Are you sure you are setting the environment variables before importing DirectStart or any other Panda module?

>> python
Python 2.6.3 (r263:75183, Oct  4 2009, 11:40:05) 
[GCC 4.4.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.getcwd()  # the directory contains a prc file
>>> os.environ["PANDA_PRC_DIR"] = os.getcwd()
>>> os.environ["PRC_DIR"] = os.getcwd()
>>> os.environ["PANDA_PRC_PATH"] = os.getcwd()
>>> os.environ["PRC_PATH"] = os.getcwd()
>>> from direct.showbase.ShowBase import ShowBase
>>> ShowBase()
Known pipe types:
(all display modules loaded.)
<direct.showbase.ShowBase.ShowBase instance at 0xb74596cc>
>>> print cpMgr
0 explicit pages:

2 implicit pages:

>>> print cpMgr.getSearchPath()


my panda is a custom makepanda build from cvs, about 10 days old.

btw, loadPrcFile() works, but is suboptimal as it can’t overwrite several things from the panda-own config

Hmm. Maybe something funny about the way os.environ works? What happens if you set these environment variables in the shell, before you launch Python?


it works if i do


(bash, btw)

ok, so it really seems to be a python thing or something with the way panda looks up those environment variables

Hmm. I guess setting os.environ isn’t as platform-independent as I’d assumed. Oh well.


But it works fine for me, on my 64-bits linux box.

I’ll be able to test this in a Mac (with Snow Leopard) in a couple of weeks, so I’ll let you know if os.environ works there…

I’ ve been able to test this on Mac OS X (Snow Leopard), and it’s not working. It worked perfectly on Windows, but here it seems it’s not finding the config files since I get:

Any ideas?


try that:

aux-display pandadx9
aux-display pandadx8
aux-display pandagl
load-display *

it should make panda look for DirectX9 first, then DX8 and use OpenGL as last solution. On non-windows boxes it always falls back to OpenGL.