Error in python script
John
john at mediamanager.com.sg
Wed Jul 7 06:05:28 EDT 1999
Hi,
I have written the program correctlly but I get the following message when I
run the program in Windows NT.
But the same program when I run it in Win 95 it is working find
This is the program
#!c:/program files/python
import string
import sys
import os
import cgi
#import urllib
data_file = open('c:/inetpub/scripts/FilmFestReview.txt', 'r')
form = cgi.FieldStorage()
header = \
"""
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<title>Extract & Write</title>
</head>
<body>
"""
footer = \
"""
</body>
</html>
"""
out = sys.stdout
begin_table = 1
out.write(header)
for line in data_file.readlines():
if begin_table:
out.write('<table border = "1">')
begin_table = 0
if line[:6] == "------":
out.write('</table>')
out.write('<br>')
begin_table = 1
continue
field_name, field_value = string.split(line, ':')
out.write('\t<tr>\n')
out.write('\t\t<td>\n')
out.write('\t\t\t%s\n' % field_name)
out.write('\t\t</td>\n')
out.write('\t\t<td>\n')
out.write('\t\t\t%s\n' % field_value)
out.write('\t\t</td>\n')
out.write('\t</tr>\n')
out.write(footer)
This is the following error I encounter when I run it using the Browser
Traceback (innermost last):
File "C:\InetPub\scripts\ffratingextract.py", line 39, in ?
field_name, field_value = string.split(line, ':')
ValueError: unpack list of wrong size
More information about the Python-list
mailing list