473,698 Members | 2,635 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 2447
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
1850
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
2287
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
1399
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
1944
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
4352
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
3305
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
1800
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
4936
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
2449
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
8683
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
8902
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
8873
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...
1
6528
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5862
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
4372
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3052
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
2339
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2007
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.