Relative paths in mod_python

Ivo van der Sangen i.g.j.v.d.sangen at student.tue.nl
Mon Mar 20 06:10:26 EST 2006


On 2006-03-19, Bruno Desthuilliers <bdesth.quelquechose at free.quelquepart.fr> 
wrote:
> Ivo van der Sangen a écrit :
>> I was wondering if I could use relative paths in a mod_python script. At
>> the moment I am defining a constant string
>> "/path/to/dir/where/script/resides". The problem with this is that when
>> I move the script including files I use to get metadata I have to change
>> this variable. The same problem occurs when I distribute the script; the
>> person using it will first have to modify it, which is not what I want. Is
>> it possible that a mod_python script has as current working directory
>> the directory where the script resides? At the moment os.getcwd()
>> returns '/'.
>
> You could set this constant in the apache conf as a PythonOption. And/Or 
> you could post this question to mod_python's mailing list !-)

I wasn't aware of the mod_python list. The next time I will post my
question there, but I don't think I will get a better answer there; the
solutions given here so far are fine.



More information about the Python-list mailing list