mod_python

1 view
Skip to first unread message

Rich

unread,
Dec 15, 2005, 11:13:59 PM12/15/05
to TurboGears
i'm having problems setting up TurboGears with mod_python.
i followed the instructions on the website, modified my
project_start.py file. adding the mp_setup and the if __name__ ==
'__main__': stuff.

i get the following in the apache error log:

[Thu Dec 15 17:12:20 2005] [notice] Apache/2.0.55 (Unix)
mod_python/3.1.4 Python/2.4.2 configured -- resuming normal operations
[Thu Dec 15 17:12:40 2005] [notice] mod_python: (Re)importing module
'mpcp'
[Thu Dec 15 17:12:40 2005] [notice] child pid 16305 exit signal
Segmentation fault (11)
[Thu Dec 15 17:13:39 2005] [notice] caught SIGTERM, shutting down

my project_start.py file works fine without apache.
any suggestions?

thanks.

Jared Kuolt

unread,
Dec 15, 2005, 11:37:55 PM12/15/05
to turbo...@googlegroups.com
Some new stuff was just recently integrated from the wiki but is not
yet up on the docs page. Take a look here:
http://trac.turbogears.org/turbogears/wiki/ModPythonIntegration

If you're running on Linux, there's a section that you should take a
look at after "Good luck!"

Let me know if this helps at all.

Jared


--
jared...@gmail.com

Damjan

unread,
Dec 18, 2005, 6:34:04 PM12/18/05
to TurboGears
Do you have mod_python working at all?

Try with the simplest mp_test.py script from the modpython
documentation, and then try to import some modules in it, like expat
and similar... to see when it breaks.

I'm suspecting your problem might be beacuse of a conflict of libraries
used by python and apache.

Rich

unread,
Dec 19, 2005, 3:56:02 PM12/19/05
to TurboGears
thanks. i followed everything on the wiki page. but it still didn't
work. I think Damjan suggested the right path for me to take.
mod_python doesn't like when I import cherrypy into my python handler
though I haven't figured out what libraries are in confict yet.

Harmen

unread,
Dec 20, 2005, 12:08:49 PM12/20/05
to TurboGears
Have you figured out this problem yet? I'm having a similar problem.

fumanchu

unread,
Dec 20, 2005, 1:47:17 PM12/20/05
to TurboGears
Just to remind you all--there's another way to use mod_python with
CherryPy-based frameworks: the WSGI modpython_gateway. See
http://projects.amor.org/misc/wiki/ModPythonGateway. The example there
is based on bare CherryPy, not TG, but it should be adaptable to your
scenario pretty easily. Not that it's inherently any better than mpcp,
but if it works for you in five minutes you might save yourself the
pain of true understanding... ;)


Robert Brewer
System Architect
Amor Ministries
fuma...@amor.org

Damjan

unread,
Dec 21, 2005, 9:38:36 AM12/21/05
to TurboGears
Harmen,
usually this happens when both Python (or a module) and Apache (or a
module) are linked to the same library but different version (or even
different compile options).

One example is expat, I'm sure Apache has it's own expat version and
it's hard to make it compile with the system expat... and I beleive
Python too comes with it's own version of expat.

The easiest way to try is use the simplest mod_python test handler and
then try to import pyexpat.

Rich

unread,
Dec 24, 2005, 11:49:25 AM12/24/05
to TurboGears
i imported pyexpat from a generic mod_python handler, and it failed. I
got a segmentation fault. so what should I do so it doesn't crash?
thanks.

Damjan

unread,
Dec 25, 2005, 12:55:13 PM12/25/05
to TurboGears
I know I've had the same problem, but now I don't remeber how (or
whether) I solved it.

I think, what I did was recompile Python's pyexpat to link the system
expat library, and tried to do the same with apache. Maybe you should
ask on the mod_python mail list or on an Apache forum.

The problem is also mentioned here:
http://www.modpython.org/FAQ/faqw.py?req=show&file=faq02.013.htp

Rich

unread,
Dec 26, 2005, 6:23:42 PM12/26/05
to TurboGears
Thanks for all the help. I got it working. Expat was my problem. I
had to upgrade so apache recognized the latest expat and it now it
works great.

bug...@gmail.com

unread,
Jan 9, 2006, 3:07:04 AM1/9/06
to TurboGears
For anyone else who has come across this problem, check this link for
detailed instructions on resolving expat library conflicts between
Python and Apache here:

http://www.dscpl.com.au/articles/modpython-006.html

I just replaced my system expat libs to match those used by Apache, and
have eliminated those seg faults.

Jeremy Petzold

unread,
Jan 9, 2006, 8:28:16 AM1/9/06
to turbo...@googlegroups.com
if you compile mod_python against apache and python, this should not
be a problem as well.
some one should tell the package maintainers about that.

Damjan

unread,
Jan 17, 2006, 1:27:55 PM1/17/06
to TurboGears
> if you compile mod_python against apache and python, this should not
> be a problem as well.
> some one should tell the package maintainers about that.

Jeremy, the problem is not in mod_python itself.
The problem is when you put together python and apache which are using
different versions of the same library (expat, mysql, libpng etc)...
It's even worse if you also use mod_php because it brings it's own set
of libraries too.

Reply all
Reply to author
Forward
0 new messages