Traceback (most recent call last):

Rachel cuteapple48 at yahoo.com
Wed Mar 24 03:10:17 CET 2004


I am new here, no idea how to use python, but I am running out of time
to complete my assignment. Following is the code that given by
assignment but with bug which I have no idea how to debug.

temperature.py

# Temperature Conversion program called temperature.py

 

import string, sys

 

# If no arguments were given, print a helpful message

if len(sys.argv)==1:

    print 'Usage: celsius temp1 temp2 ...'

    sys.exit(0)

# Loop over the arguments

for i in sys.argv[1:]:

    try: 

        fahrenheit=float(string.atoi(i))

    except string.atoi_error:

      print repr(i), "not a numeric value"

    else:

      celsius=(fahrenheit-32)*5.0/9.0

      print '%i\260F = %i\260C' % (int(fahrenheit), int(celsius+.5))

After I type in the above code in new window save as temperature.py
when I click Run Module, Python show me the following error message

Usage: celsius temp1 temp2 ...

Traceback (most recent call last):
  File "C:/Python23/Temperature.py", line 15, in -toplevel-
    sys.exit(0)
SystemExit: 0

Anyone have idea how to solve this up... I am using python 2.3(IDLE)
(Python GUI)

Deadline of assignment is on next monday.



More information about the Python-list mailing list