473,748 Members | 2,328 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Install mod_python

Hi,
I am new to python. I am trying to install mod_python in my
computer(WinXP Pro, Apache 2.0.50, python2.3.4). I added the following
statements in my Apache configuration file httpd.conf

<Directory "C:/Apache Group/Apache2/htdocs/python">
AddHandler python-program .py
PythonHandler myscript
</Directory>

LoadModule python_module modules/mod_python.so

And restart my Apache. edit myscript.py as following and put the file
in the directory of C:/Apache Group/Apache2/htdocs/python/,

from mod_python import apache
def handler(req):
req.content_typ e = "text/plain"
req.send_http_h eader()
req.write("Hell o World!")
return apache.OK

but it gives following error message:
The server encountered an internal error or misconfiguratio n and was
unable to complete your request.

The error.log shows as,

[Sat Jul 17 23:26:37 2004] [error] [client 127.0.0.1] PythonHandler
myscript: Traceback (most recent call last):
[Sat Jul 17 23:26:37 2004] [error] [client 127.0.0.1] PythonHandler
myscript: File "C:\\Python23\\ Lib\\site-packages\\mod_p ython\\apache.p y",
line 287, in HandlerDispatch \n log=debug)
[Sat Jul 17 23:26:37 2004] [error] [client 127.0.0.1] PythonHandler
myscript: File "C:\\Python23\\ Lib\\site-packages\\mod_p ython\\apache.p y",
line 457, in import_module\n module = imp.load_module (mname, f, p,
d)
[Sat Jul 17 23:26:37 2004] [error] [client 127.0.0.1] PythonHandler
myscript: File "C:/Apache
Group/Apache2/htdocs/python/\\myscript.py", line 2
[Sat Jul 17 23:26:37 2004] [error] [client 127.0.0.1] PythonHandler
myscript: def handler(req):
[Sat Jul 17 23:26:37 2004] [error] [client 127.0.0.1] PythonHandler
myscript: ^
[Sat Jul 17 23:26:37 2004] [error] [client 127.0.0.1] PythonHandler
myscript: SyntaxError: invalid syntax

Who could give me some hints? Thanks a lot!

Nancy Wang
Jul 18 '05 #1
3 2449
Nancy wrote:
Hi,
I am new to python. I am trying to install mod_python in my
computer(WinXP Pro, Apache 2.0.50, python2.3.4). I added the following
statements in my Apache configuration file httpd.conf

<Directory "C:/Apache Group/Apache2/htdocs/python">
AddHandler python-program .py
PythonHandler myscript
</Directory>

LoadModule python_module modules/mod_python.so

And restart my Apache. edit myscript.py as following and put the file
in the directory of C:/Apache Group/Apache2/htdocs/python/,

from mod_python import apache
def handler(req):
req.content_typ e = "text/plain"
req.send_http_h eader()
req.write("Hell o World!")
return apache.OK

but it gives following error message:

Looks you got your indentation wrong. What happens if you try the
following instead:

from mod_python import apache

def handler(req):
req.content_typ e = "text/plain"
req.send_http_h eader()
req.write("Hell o World!")
return apache.OK
Jul 18 '05 #2
Nancy wrote:
Hi,
I am new to python. I am trying to install mod_python in my
computer(WinXP Pro, Apache 2.0.50, python2.3.4). I added the following
statements in my Apache configuration file httpd.conf

<Directory "C:/Apache Group/Apache2/htdocs/python">
AddHandler python-program .py
PythonHandler myscript
</Directory>

LoadModule python_module modules/mod_python.so

And restart my Apache. edit myscript.py as following and put the file
in the directory of C:/Apache Group/Apache2/htdocs/python/,

from mod_python import apache
def handler(req):
req.content_typ e = "text/plain"
req.send_http_h eader()
req.write("Hell o World!")
return apache.OK

but it gives following error message:
The server encountered an internal error or misconfiguratio n and was
unable to complete your request.

The error.log shows as,

[Sat Jul 17 23:26:37 2004] [error] [client 127.0.0.1] PythonHandler
myscript: Traceback (most recent call last):
[Sat Jul 17 23:26:37 2004] [error] [client 127.0.0.1] PythonHandler
myscript: File "C:\\Python23\\ Lib\\site-packages\\mod_p ython\\apache.p y",
line 287, in HandlerDispatch \n log=debug)
[Sat Jul 17 23:26:37 2004] [error] [client 127.0.0.1] PythonHandler
myscript: File "C:\\Python23\\ Lib\\site-packages\\mod_p ython\\apache.p y",
line 457, in import_module\n module = imp.load_module (mname, f, p,
d)
[Sat Jul 17 23:26:37 2004] [error] [client 127.0.0.1] PythonHandler
myscript: File "C:/Apache
Group/Apache2/htdocs/python/\\myscript.py", line 2
[Sat Jul 17 23:26:37 2004] [error] [client 127.0.0.1] PythonHandler
myscript: def handler(req):
[Sat Jul 17 23:26:37 2004] [error] [client 127.0.0.1] PythonHandler
myscript: ^
[Sat Jul 17 23:26:37 2004] [error] [client 127.0.0.1] PythonHandler
myscript: SyntaxError: invalid syntax

Who could give me some hints? Thanks a lot!

Nancy Wang


Looks like you got your indentation wrong. What happens if you try the
following instead:

from mod_python import apache

def handler(req):
req.content_typ e = "text/plain"
req.send_http_h eader()
req.write("Hell o World!")
return apache.OK

--
Vincent
Jul 18 '05 #3
vincent wehren <vi*****@visual trans.de> wrote in message news:<cd******* ***@news5.tilbu 1.nb.home.nl>.. .
Nancy wrote:
Hi,
I am new to python. I am trying to install mod_python in my
computer(WinXP Pro, Apache 2.0.50, python2.3.4). I added the following
statements in my Apache configuration file httpd.conf

<Directory "C:/Apache Group/Apache2/htdocs/python">
AddHandler python-program .py
PythonHandler myscript
</Directory>

LoadModule python_module modules/mod_python.so

And restart my Apache. edit myscript.py as following and put the file
in the directory of C:/Apache Group/Apache2/htdocs/python/,

from mod_python import apache
def handler(req):
req.content_typ e = "text/plain"
req.send_http_h eader()
req.write("Hell o World!")
return apache.OK

but it gives following error message:
The server encountered an internal error or misconfiguratio n and was
unable to complete your request.

The error.log shows as,

[Sat Jul 17 23:26:37 2004] [error] [client 127.0.0.1] PythonHandler
myscript: Traceback (most recent call last):
[Sat Jul 17 23:26:37 2004] [error] [client 127.0.0.1] PythonHandler
myscript: File "C:\\Python23\\ Lib\\site-packages\\mod_p ython\\apache.p y",
line 287, in HandlerDispatch \n log=debug)
[Sat Jul 17 23:26:37 2004] [error] [client 127.0.0.1] PythonHandler
myscript: File "C:\\Python23\\ Lib\\site-packages\\mod_p ython\\apache.p y",
line 457, in import_module\n module = imp.load_module (mname, f, p,
d)
[Sat Jul 17 23:26:37 2004] [error] [client 127.0.0.1] PythonHandler
myscript: File "C:/Apache
Group/Apache2/htdocs/python/\\myscript.py", line 2
[Sat Jul 17 23:26:37 2004] [error] [client 127.0.0.1] PythonHandler
myscript: def handler(req):
[Sat Jul 17 23:26:37 2004] [error] [client 127.0.0.1] PythonHandler
myscript: ^
[Sat Jul 17 23:26:37 2004] [error] [client 127.0.0.1] PythonHandler
myscript: SyntaxError: invalid syntax

Who could give me some hints? Thanks a lot!

Nancy Wang


Looks like you got your indentation wrong. What happens if you try the
following instead:

from mod_python import apache

def handler(req):
req.content_typ e = "text/plain"
req.send_http_h eader()
req.write("Hell o World!")
return apache.OK

-----

Yes, my indentation was wrong. Thank you very much!

Nancy
Jul 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1851
by: ted | last post by:
Hi, I'm having a problem trying to get mod_python running on Win2000. I'm getting the following error when I start Apache: C:\Program Files\Apache Group\Apache2\bin>Apache.exe Syntax error on line 163 of C:/Program Files/Apache Group/Apache2/conf/httpd.conf: Cannot load C:/Program Files/Apache Group/Apache2/modules/mod_python.so
1
2290
by: wolf | last post by:
i would like to briefly share my experiences with installing mod_python on a w2000 box. i must say that i believe the installation process to be unnecessarily complicated by the simple fact that the installer itself seems to be buggy -- in my case, no combination of mod_python 3.0.4, 3.1.2b and python 2.2.3, 2.3.3 ever came to completion. rather, the installer would exit -- after an initial declaration of having successfully found python...
7
1401
by: Daniel Bickett | last post by:
I've been trying to convince my host to install python/mod_python on his server for a while now, however there are a number of reasons he is reluctant to do so, which I will outline here: 1. His major reason is optimization. He uses Zend's optimization of PHP as an example, and he has stated that python is rather resource consuming. 2. Another one of his points is that he is unexperienced in installing python, and he would not know how...
6
1947
by: Anthony L. | last post by:
I am writing a web application that is comparable to a content management system used in blogging. I really want to use Python after having done some evaluation coding using Python 2.3.5 with mod_python 3.1.4 running on Apache 2.0 with the Publisher handler. However, I am still very hesitant to settle on Python. All my research brings up the same collection of scant articles and old mailing list messages that reference each other. I am...
1
4357
by: treelife | last post by:
I'm getting and internal server error when | run the following mod_python script. I am actually trying to run Django. Script: from mod_python import apache def handler(req): req.content_type = 'text/plain' req.write("Under Construction")
2
3308
by: exhuma.twn | last post by:
Hi again, as soon as I try to make use of the "session" object inside a psp-template file, I get the following error: Mod_python error: "PythonHandler mod_python.publisher" Traceback (most recent call last): File "/usr/lib/python2.4/site-packages/mod_python/apache.py", line
3
1802
by: Michael | last post by:
Hey everyone, Is it possible to automatically insert headers/footers using mod_python? I will be not be using PSP's, so I cannot use the PSP/include solution. Furthermore, the header will be dynamic; it won't be a static HTML page. In short, I've been looking for a page layout facility using mod_python.
3
4937
by: joe jacob | last post by:
I configured apache to execute python scripts using mod_python handler. I followed below mentioned steps to configure apache. 1. In http.conf I added <Directory "D:/softwares/Apache2.2/htdocs"> AddHandler mod_python .py PythonHandler mptest PythonDebug On </Directory>
4
2451
by: Con | last post by:
Hi, how does properly install the Python MySQL db module for Mac OS X? I was only able to locate the Win32 modules. Thanks in advance, -Conrad
0
9359
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9310
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9236
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8235
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6072
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4863
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3298
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2774
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2206
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.