Configure Python to work in WAMP

Reply

Join Date: May 2006
Posts: 1,422
Reputation: stymiee is on a distinguished road 
Solved Threads: 35
Moderator
stymiee's Avatar
stymiee stymiee is offline Offline
He's No Good To Me Dead

Configure Python to work in WAMP

 
0
  #1
May 13th, 2008
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:

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

  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.
John Conde
Brainyminds | Merchant Account Services | I Love Code
IT'S HERE: Merchant Accounts 101 Everything you need to know about merchant accounts!
Reply With Quote Quick reply to this message  
Join Date: May 2006
Posts: 1,422
Reputation: stymiee is on a distinguished road 
Solved Threads: 35
Moderator
stymiee's Avatar
stymiee stymiee is offline Offline
He's No Good To Me Dead

Re: Configure Python to work in WAMP

 
0
  #2
May 13th, 2008
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.
John Conde
Brainyminds | Merchant Account Services | I Love Code
IT'S HERE: Merchant Accounts 101 Everything you need to know about merchant accounts!
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 46
Reputation: akshit is an unknown quantity at this point 
Solved Threads: 0
akshit akshit is offline Offline
Light Poster

Re: Configure Python to work in WAMP

 
0
  #3
Jun 30th, 2008
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.
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 13
Reputation: VelcroMan is an unknown quantity at this point 
Solved Threads: 1
VelcroMan VelcroMan is offline Offline
Newbie Poster

Re: Configure Python to work in WAMP

 
0
  #4
Jul 1st, 2008
Originally Posted by akshit View Post
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
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the Python Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC