[Zope] os.system() - problem when using with lynx browser in linux

Jim Whitman jim at jameswhitman.org
Mon Sep 15 01:04:15 EDT 2003


Hi
Thanks to those who helped. I've discovered that the problem was 
the lack of a tmpdir environment variable for Lynx that caused it to 
exit before completing its download of a page. It was confused as to 
who it was running as within a Zope-run python script.

Best wishes

On 11 Sep 2003 at 7:02, Jim Whitman wrote:

From:           	"Jim Whitman" <jim at jameswhitman.org>
To:             	zope at zope.org
Date sent:      	Thu, 11 Sep 2003 07:02:01 +1200
Priority:       	normal
Subject:        	[Zope] os.system() - problem when using with lynx browser in linux

> Hi
> I've created an external method that runs the lynx browser on linux
> and which dumps the output to a temporary file for display on a web
> page in zope.
> 
> But the output from the dump is limited to 20k in size (I began with a
> script that dumped to a file on the hard drive rather than a temporary
> file) which provided this figure. The problem is that most pages are
> larger than the dump size that's allowed when I use the method in zope
> - so the output from the script is usually truncated.
> 
> external method------
> 
> def execute(url,fileName):
> 
>  import string, os, tempfile
> 
>       try:
> 
>           fileName =tempfile.mktemp()
> 
>           lynx=('/usr/bin/lynx  -accept_all_cookies -dump -
> hiddenlinks=ignore ')
> 
>           lynx=lynx + url
> 
>           lynx=lynx + ' > '
> 
>           lynx=lynx + fileName 
> 
>           os.system(lynx)
> 
>           out=open(fileName,'r').read()
> 
>           os.remove(fileName)
> 
>           return out
> 
> except:
> 
>           error='Sorry - service not available - please try again'
> 
>            return error
> 
> I've also tried os.popen() and have the same problem.
> 
> I've tried running a similar script in straight python and do not find
> the same problem.
> 
> Is this an issue with python in zope - I use a binary of zope 2.5
> rather than my own python? Or is this the way that zope is set up and
> there's a configuration I'm missing?
> 
> Any suggestions?
> Thanks
> Jim
> 
> _______________________________________________
> Zope maillist  -  Zope at zope.org
> http://mail.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - 
>  http://mail.zope.org/mailman/listinfo/zope-announce
>  http://mail.zope.org/mailman/listinfo/zope-dev )





More information about the Zope mailing list