944,007 Members | Top Members by Rank

Ad:
  • Python Discussion Thread
  • Unsolved
  • Views: 15519
  • Python RSS
May 13th, 2008
0

Configure Python to work in WAMP

Expand Post »
I use WAMP to develop my PHP/MySQL applications locally before moving them to a production server. I want to start teaching myself Python and wish to add Python to my installation. I have downloaded and installed Python 2.5 and also installed mod_python. Unfortunately getting Apache to recognize that Python is installed and run Python web pages isn't working. I either get a Python error or the contents of the Python file display on the screen.

Has anyone had any luck getting Python to work with WAMP specifically? If not any experience getting it to work with Apache on Windows would be appreciated.

Here is the error message I get:

Quote ...
MOD_PYTHON ERROR

ProcessId: 800
Interpreter: 'localhost'

ServerName: 'localhost'
DocumentRoot: 'C:/wamp/www/'

URI: '/python/index.py'
Location: None
Directory: 'C:/wamp/www/'
Filename: 'C:/wamp/www/python/index.py'
PathInfo: None

Phase: 'PythonHandler'
Handler: 'index.py'

Traceback (most recent call last):

File "C:\wamp\bin\python\Lib\site-packages\mod_python\importer.py", line 1537, in HandlerDispatch
default=default_handler, arg=req, silent=hlist.silent)

File "C:\wamp\bin\python\Lib\site-packages\mod_python\importer.py", line 1202, in _process_target
module = import_module(module_name, path=path)

File "C:\wamp\bin\python\Lib\site-packages\mod_python\importer.py", line 304, in import_module
return __import__(module_name, {}, {}, ['*'])

ImportError: No module named index.py
Here is the code in index.py

Python Syntax (Toggle Plain Text)
  1. from mod_python import apache
  2.  
  3. def handler(req):
  4.  
  5. req.content_type = "text/plain"
  6. req.write("Hello World!")
  7.  
  8. return apache.OK
Last edited by stymiee; May 13th, 2008 at 12:21 am.
Moderator
Reputation Points: 161
Solved Threads: 38
He's No Good To Me Dead
stymiee is offline Offline
1,422 posts
since May 2006
May 13th, 2008
0

Re: Configure Python to work in WAMP

Update: I changed PythonHandler to say PythonHandler mod_python.publisher in my http.conf file and that solved my other errors. But now I get a 404 error for index.py which is definitely in the right place.
Moderator
Reputation Points: 161
Solved Threads: 38
He's No Good To Me Dead
stymiee is offline Offline
1,422 posts
since May 2006
Jun 30th, 2008
0

Re: Configure Python to work in WAMP

hi..

i am also a php/mysql user, and i have till date used PHP only in this regard. Now, i want to learn and use Python/Perl with WAMP.

1. Is this possible?
2. If so, what additional softwares would i need to install to run Python/Perl (i already have WAMP server installed and working)
3. Where can i get these additional softwares from?

any help will be highly appreciated...

thx...
Last edited by akshit; Jun 30th, 2008 at 12:04 pm.
Reputation Points: 10
Solved Threads: 0
Light Poster
akshit is offline Offline
46 posts
since Jun 2008
Jul 1st, 2008
0

Re: Configure Python to work in WAMP

Click to Expand / Collapse  Quote originally posted by akshit ...
hi..

i am also a php/mysql user, and i have till date used PHP only in this regard. Now, i want to learn and use Python/Perl with WAMP.

1. Is this possible?
2. If so, what additional softwares would i need to install to run Python/Perl (i already have WAMP server installed and working)
3. Where can i get these additional softwares from?

any help will be highly appreciated...

thx...
1. Yes it is. mod_python is required if you want to run python.
2. I recommend you to take a look at Django (http://www.djangoproject.com) and TurboGears (www.turbogears.org).
3. The links are above
Reputation Points: 10
Solved Threads: 1
Newbie Poster
VelcroMan is offline Offline
13 posts
since Jun 2008
Dec 12th, 2009
0

python on wampserver2

hey can you please help me i have a problem i am trying to get python to run on wamp2 my problem is on this page http://www.wampserver.com/phorum/read.php?2,52963

i am using python25 on apache 2.2.11 and i have already installed mod_python but that is where the problem is
Reputation Points: 10
Solved Threads: 0
Newbie Poster
nickdudego3 is offline Offline
1 posts
since Dec 2009
Dec 21st, 2009
0

I saw a solution here... hope this helps

Click to Expand / Collapse  Quote originally posted by stymiee ...
I use WAMP to develop my PHP/MySQL applications locally before moving them to a production server. I want to start teaching myself Python and wish to add Python to my installation. I have downloaded and installed Python 2.5 and also installed mod_python. Unfortunately getting Apache to recognize that Python is installed and run Python web pages isn't working. I either get a Python error or the contents of the Python file display on the screen.

Has anyone had any luck getting Python to work with WAMP specifically? If not any experience getting it to work with Apache on Windows would be appreciated.

Here is the error message I get:



Here is the code in index.py

Python Syntax (Toggle Plain Text)
  1. from mod_python import apache
  2.  
  3. def handler(req):
  4.  
  5. req.content_type = "text/plain"
  6. req.write("Hello World!")
  7.  
  8. return apache.OK
Check this out. I'm going to try this and post back the results.
http://woommle.org/?p=21
Reputation Points: 10
Solved Threads: 0
Newbie Poster
tweetychums is offline Offline
1 posts
since Dec 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Python Forum Timeline: Multiplication program help
Next Thread in Python Forum Timeline: simple function help





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC