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

Jim Whitman jim at jameswhitman.org
Thu Sep 11 08:02:01 EDT 2003


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



More information about the Zope mailing list