LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Set pythonpath from script at boot time (https://www.linuxquestions.org/questions/linux-server-73/set-pythonpath-from-script-at-boot-time-917948/)

estratos 12-09-2011 01:51 PM

Set pythonpath from script at boot time
 
Hi, under Debian, I need to add some paths to the PYTHONPATH environment variable for all users, including root. I want to do this because I have a custom sh script in /etc/init.d that runs a couple of python scripts needing the new pythonpath. The problem is that whatever I try only alters PYTHONPATH in the context of an open shell. No way to do this during startup.

I've tried exporting the new PYTHONPATH from the sh script as follows:

export PYTHONPATH="$PYTHONPATH:/new/path/"

and also running a new Python script that calls sys.path.append

but nothing works.

Thanks in advance for your ideas!

EricTRA 12-11-2011 02:39 AM

Hello,

Have a look at a file named site.py in /usr/lib/python<version>/ and in /usr/lib/python<version>/dist-packages. There you'll find the information you need to set / change your PYTHONPATH. More information and clarification can be found here on the Python documentation website.

Kind regards,

Eric


All times are GMT -5. The time now is 09:27 AM.