>>> On 9/25/2008 at 6:08 AM, in message
<[EMAIL PROTECTED]>, Gilad Raphaelli
<[EMAIL PROTECTED]> wrote:

> 
> 
> 
> 
> ----- Original Message ----
>> From: Brad Nicholes <[EMAIL PROTECTED]>
>> To: Lieting Yu <[EMAIL PROTECTED]>; ganglia-general@lists.sourceforge.net; 
> Gilad Raphaelli <[EMAIL PROTECTED]>
>> Sent: Thursday, September 25, 2008 1:05:11 AM
>> Subject: Re: [Ganglia-general] mod_python on Solaris not scanning  directory
>> 
>> >>> On 9/23/2008 at  7:03 PM, in message
>> <[EMAIL PROTECTED]>, Gilad Raphaelli
>> wrote: 
>> > Lieting,
>> > 
>> > I believe I ran into the same issue and cleared it up with this patch to 
>> > mod_python.c:
>> > 
>> > --- mod_python.c.orig   2008-09-24 10:52:17.000000000 +1000
>> > +++ mod_python.c        2008-09-24 10:59:06.000000000 +1000
>> > @@ -510,6 +510,11 @@
>> >      /* Set up the python path to be able to load module from our module 
>> > path */
>> >      set_python_path(path);
>> >      Py_Initialize();
>> > +
>> > +    PyObject *sys_path = PySys_GetObject("path");
>> > +    PyObject *addpath = PyString_FromString(path);
>> > +    PyList_Append(sys_path, addpath);
>> > +
>> >      PyEval_InitThreads();
>> >      gtstate = PyEval_SaveThread();
>> > 
>> > This does the equivalent of a 'sys.path.append(path)' without any error 
>> > handling.  I haven't heard back from the developer list whether this is 
>> > the 
> 
>> > right approach but perhaps it will get you going for now.
>> > 
>> 
>> The call to the function set_python_path(path) should have done the same 
> thing 
>> by setting up the PYTHONPATH environment variable.  Are you suggesting that 
> we 
>> add the above code as well or that the above code should replace the code 
> that 
>> already exists in set_python_path()?
> 
> I'm not exactly an authority on embedding the python interpreter in C but I 
> believe I ran into the same issue that Lieting is reporting, on a rhel4 box, 
> and solved it with the code above.  Coincidentally, the question of the 
> 'correct' way to set the module import path came up just a few days before I 
> had this problem - 
> http://mail.python.org/pipermail/python-list/2008-September/506206.html.  I 
> think that just doing the above without setting the PYTHONPATH environment 
> variable should work regardless of the platform.
> 

OK. Do you know which version of Python introduced the PySys_GetObject() 
function?  It seems to be an undocumented function until python 2.6.  It might 
be good to know what the issue is with this function and why it wasn't 
documented before we start using it.

Brad


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Ganglia-general mailing list
Ganglia-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ganglia-general

Reply via email to