[SOLVED]pack3d export environment variable

Hi all. I’m using openCV for a game using a webcam.
I don’t know why but under linux, you have to “export LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so” for the video to works.
So i’m using a batch

export LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so
panda3d -f VideoPuzzle.p3d

but the variable LD_PRELOAD is not exported.
the bash works pefectly with

export LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so
python main.py

It look the panda3d instance is runing on a separate shell,
so is there a way to define such a variable into my .p3d ? , or a way to run panda3d giving it this var ?

Thanks for your time

I don’t know if this solves, but you could try to use the switch -c, setting the option keep_user_env. More info here.

Thanks a lot Yaio, but it does not make the trick, i think :

I put LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so in my ~/.bashrc and then re-pack with “panda3d packp3d.p3d -d vp -r vision -p /usr/share/pyshared/PIL -p /usr/share/pyshared/psyco -s /usr/share/pyshared -c keep_user_env=1 -o /home/zozi/Documents/video-puzzle/VideoPuzzle.p3d”.

i have a “os.system(“echo $LD_PRELOAD”)” in my code that still return nothing …

Maybe you haven’t reloaded the settings contained in bashrc (those settings are loaded when you load bash), because it seems to work. As instance I’ve this file main.py:

import direct.directbase.DirectStart, os
os.system( 'echo $FOO' )

Then I set a variable:

$ echo $FOO

$ export FOO=BAR
$ echo $FOO

Then I pack the previous code:

$ packp3d -o foo.p3d -c keep_user_env=1

Then I obtain as expected:

$ panda3d foo.p3d 

You’re wright, it works perfectly, my mistake .

Thanks again