Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 696949
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T03:07:04+00:00 2026-05-14T03:07:04+00:00

I edited this question after i found a solution… i need to understand why

  • 0

I edited this question after i found a solution… i need to understand why the solution worked instead of my method?

This is likely to be a silly question. I tried searching other questions that are related… but to no avail.

i am running Apache/2.2.11 (Ubuntu) DAV/2 SVN/1.5.4 PHP/5.2.6-3ubuntu4.5 with Suhosin-Patch mod_python/3.3.1 Python/2.6.2

i have a script called test.py

#! /usr/bin/python
print "Content-Type: text/html"     # HTML is following
print                               # blank line, end of headers

print "hello world"

running it as an executable works…

/var/www$ ./test.py
Content-Type: text/html

hello world

when i run http://localhost/test.py i get a 404 error.

What am i missing?

i used this resource to enable python parsing on apache. http://ubuntuforums.org/showthread.php?t=91101

From that same thread… the following code worked.. why?
#!/usr/bin/python

import sys
import time

def index(req):

# Following line causes error to be sent to browser
# rather than to log file (great for debug!)

    sys.stderr = sys.stdout

    #print "Content-type: text/html\n"

    #print """
    blah1 = """<html>
    <head><title>A page from Python</title></head>
    <body>
    <h4>This page is generated by a Python script!</h4>
    The current date and time is """

    now = time.gmtime()
    displaytime = time.strftime("%A %d %B %Y, %X",now)

    #print displaytime,
    blah1 += displaytime

    #print """
    blah1 += """
    <hr>
    Well House Consultants demonstration
    </body>
    </html>
    """
    return blah1
  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T03:07:04+00:00Added an answer on May 14, 2026 at 3:07 am

    I think the mod_python’s Publisher Handler is expecting to find index function in test.py.

    You can call any function inside test.py by putting it in the end of URL, e.g. http://localhost/test.py/any_func, the default function being index if none given.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Warning: This question has been heavily edited. I tried my best to guess the
Edited: SOLUTION FOUND. This is strange and not the best solution, but I just
Edited Question: This should be clear. using System; namespace UpdateDateTimeFields { class Program {
I've edited this quite a bit and bolded my question at this point. I
NB: This question has been extensively edited to make it more relevant, for completeness
I've heavily edited this question because responses indicated I wasn't being clear problem: UI
Note: I edited this question to make it easier for other people with the
This question was marked as duplicate, and after the asker succeeded in renaming the
EDITED QUESTION Hi this is the total workflow of this project we have a
This is a follow up from this question, Lock Cells after Data Entry .

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.