Всем привет,
изучаю python для написания cgi
в книжке Python Network Programming by Sebastian V. Tiponut Technical University Timisoara Version 0.00, 16. July 2001
стр 24 есть код
<html>
<form name='myform' method='POST' action='/cgi-bin/mycgi.py'>
<input type='text' name='yourname' size='30'>
<input type='textarea' name='comment' width='30' heigth='20'>
<input type='submit'>
</form>
</html>
скрипт обработки данных
import cgi
FormOK = 0;
MyForm = cgi.FieldStorage();
if MyForm.has_key('yourname') and MyForm.has_key('comment' ):
FormOK = 1
print ‘Content-Type: text/html’
print
if FormOK:
print ‘<p>Your name: ’, Myform.value, ‘<br>’
print ‘<p>You comment: ’, MyForm.value
else:
print ‘Error: fields have not been filled.’
но броузер не выдает
Myform.value
MyForm.value
веб сервер пишет
localhost - - Traceback (most recent call last):
File “c:\temp\python\http\cgi-bin\mycgi.py”, line 10, in <module>
print ‘<p>Your name: ’, Myform.value, ‘<br>’
NameError: name ‘Myform’ is not defined
localhost - - CGI script exit status 0x1
подскажите чайнику почему не определена Myform ?