[Tutor] CGI-version not working while
similar command-line script is fine
Kent Johnson
kent_johnson at skillsoft.com
Sun Sep 5 18:26:49 CEST 2004
I just tried this with Lynx Version 2.8.4rel.1-mirabilos:
> lynx --dump www.google.com
I didn't get any output. If I try
> lynx --dump http://www.google.com
then it works. Could it be that simple?
Also this works for me:
>>> import os
>>> print os.popen(r'C:\Downloads\Apps\LYNX\LYNX.EXE -dump
http://www.google.com').read()
Kent
At 05:08 PM 9/5/2004 +0100, Gerhard Venter wrote:
>Hi Kent
>
>Thanks - my code is below. It should output a plain text version of any
>website
>
>G
>
>Kent Johnson wrote:
>
>>This should work. My guess is you have an error in your script, maybe a
>>problem with quoting or string substitution. Can you show us the script
>>that is having trouble?
>import cgi, os
>import cgitb; cgitb.enable()
>
>form = cgi.FieldStorage()
>website = form["websitename"].value
>command = 'lynx --dump ' + website
>k=os.popen(command, 'r')
>
>print 'Content-type: text/plain'
>print
>
>#print command (this shows the right thing- for example lynx --dump
>www.google.com)
>for line in k.readlines():
> print(line)
>_______________________________________________
>Tutor maillist - Tutor at python.org
>http://mail.python.org/mailman/listinfo/tutor
More information about the Tutor
mailing list