eric.frederich wrote:
Is there a way to set up environment variables in python itself
without having a wrapper script.

The wrapper script is now something like....

#!/bin/bash

export LD_LIBRARY_PATH="/some/thing/lib:$LD_LIBRARY_PATH"
export LD_LIBRARY_PATH="/another/thing/lib:$LD_LIBRARY_PATH"

export PATH="/some/thing/bin:$PATH"
export PATH="/another/thing/bin:$PATH"

python ./someScript.py
try in someScript.py

os.environ['PATH'] = "/some/thing/bin:"+ os.environ['PATH']

example:

import subprocess
import os
p = subprocess.Popen('/bin/echo $TEST', shell=True, stdout=subprocess.PIPE )
p.communicate()[0]
> '\n'

os.environ['TEST'] = 'hello'
p = subprocess.Popen('/bin/echo $TEST', shell=True, stdout=subprocess.PIPE )
p.communicate()[0]
> 'hello\n'

JM


--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to