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

  • Home
  • SEARCH
  • 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 4339858
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T11:16:18+00:00 2026-05-21T11:16:18+00:00

I have a really simple program that checks the date and returns if the

  • 0

I have a really simple program that checks the date and returns if the combined month+day+year is a so called happy number (a number whos sum of the square of its digits equal one) or not.
The program works fine when I run it locally through python but when I try to run it through the appengine, either locally or online, nothing is displayed but a single TEST print line.
I can’t figure out why the appengine will not display the function.

Any help or suggestions would be really appreciated as I’m stuck.
The appengine logs show a GET request:

" INFO     2011-04-14 18:19:14,981 dev_appserver.py:3317] "GET / HTTP/1.1" 200 -"

but nothing afterwards.

import sys
import datetime

def main():
    date = datetime.date.today()
    datearray=[0,0,0]
    datearray[0]=str(date.month)
    datearray[1]=str(date.day)
    datearray[2]=str(date.year)
    joined = ''.join(datearray)
    print "Date:",int(joined)
    print happynums(int(joined))

def happynums(num):
    total = int(num)
    varnum = 0
    bin=0    
    x=0
    past=set()

    while total!=1:
        if total in past:
            return "Sad day :("
        past.add(total)
        list = map(int,str(total))
        total=0
        for i in list:
            total = total + i**2
        if total==1:
            return "Happy day :)"

if __name__ == '__main__': 
    main()
    print "TEST"
  • 1 1 Answer
  • 0 Views
  • 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-21T11:16:18+00:00Added an answer on May 21, 2026 at 11:16 am

    You can’t simply print to stdout in a CGI script; you must first send headers followed by a blank line. Your output is being interpreted by your browser as HTTP headers and isn’t printing.

    You almost certainly want to be using some kind of WSGI framework to handle this for you.

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

Sidebar

Related Questions

I have a really simple XML file that I'm trying to read, but I
I have a simple program that looks up details of an IP you give
I have a cherryPy program that returns a page that has an image (plot)
I have a simple PHP program that list some topics. for example I have
I have simple serial port program that is supposed to read the serial port
I have a simple updater program that copies files from a company server to
I have really simple XML (HTML) parsing ANTLR grammar: wiki: ggg+; ggg: tag |
I have a really simple Rails app. Basically an article with comments. I want
I have a really simple blog application and I want to add a really
I have a really simple mod-rewrite rule : RewriteRule ^(.*)$ index.php?url=$1 [PT,L] As an

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.