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 6070275
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:54:53+00:00 2026-05-23T09:54:53+00:00

I am trying to run the following HelloWorld Script at Command Line import tornado.httpserver

  • 0

I am trying to run the following HelloWorld Script at Command Line

import tornado.httpserver
import tornado.ioloop
import tornado.options
import tornado.web

from tornado.options import define, options

define("port", default=8888, help="run on the given port", type=int)


class MainHandler(tornado.web.RequestHandler):
    def get(self):
        self.write("Hello, world")


def main():
    tornado.options.parse_command_line()
    application = tornado.web.Application([
        (r"/", MainHandler),
    ])
    http_server = tornado.httpserver.HTTPServer(application)
    http_server.listen(options.port)
    tornado.ioloop.IOLoop.instance().start()


if __name__ == "__main__":
    main()

and I am getting the following error

File "helloworld.py", line 17, in ?
    import tornado.httpserver
  File "/home/username/public_html/tornado-1.2.1/tornado/httpserver.py", line 28, in ?
    from tornado import ioloop
  File "/home/username/public_html/tornado-1.2.1/tornado/ioloop.py", line 184
    action if action is not None else signal.SIG_DFL)
            ^
SyntaxError: invalid syntax

Brand New to Python, can someone explain what the problem being pointed out is? P.S. helloworld.py is in the /home/username/public_html/tornado-1.2.1/ directory, and there is a tornado subdirectory in the same directory.

Edit: (Ignore this edit now)
The command i am running is

python helloworld.py

The result of python -V is

Python 2.4.3

Unfortunately Tornado doesn’t work with versions before 2.5 so this might be the problem. However, I have installed Python 2.6.6 How do I ensure that it is running with the correct version of Python and not the older one?

EDIT II

Now I have set Python to 2.6.6

and running

python helloworld.py

doesn’t produce any output. The program just freezes at the command line.

Any thoughts here?

  • 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-23T09:54:53+00:00Added an answer on May 23, 2026 at 9:54 am

    As you’ve found out yourself, the problem is that python 2.4 does not support the conditional expression operator.

    How you can switch to another Python version depends on your system. On debian and Ubuntu, you can edit /usr/share/python/debian_defaults. On all Linux systems, you can remove /usr/bin/python and link to the version you’d like:

    sudo mv /usr/bin/python /usr/bin/python.dist
    sudo ln -s /usr/bin/python2.5 /usr/bin/python
    

    Alternatively, you can modify the PATH environment variable to contain a directory with the desired python binary before /usr/bin (this is probably the way to go on Windows). You can make this permanent by editing ~/.profile (at every login) or ~/.bashrc (in interactive, bash shells).

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

Sidebar

Related Questions

I'm trying to run the following command: find . -iname '.#*' -print0 | xargs
I'm trying to run a batch file, as another user, from my web app.
I'm trying to run the following rocket launching application: object HelloWorld { def main(args:
I'm trying to run the following script in powershell: $counters = @() $counters =
I'm trying to run the following commands: replace -x must A2input.txt replace -x a
Hey everyone, I am trying to run the following program, but am getting a
I get the following error when trying to run the latest Cygwin version of
I'm getting the following error when trying to run a JSP. I'm using Tomcat
I am trying to run the sample HelloWorld Azure application in the Development Fabric
I am new to Tomcat, and trying to run a simple HelloWorld servlet. I

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.