Hi. I have an app that has been in production for about two years. Today I 
moved the application and everything went well except for a small function 
that uses subprocess call with phantomjs to generate a pdf file, it used to 
work fine, but now I get a Internal Server Error. 

The controller looks like this:

def recibo_pdf():
        uuid=request.vars.uuid
        
jsf=request.env.web2py_path+'/applications/'+request.application+'/static/js/rasterize.js'
        
url=URL('honorarios','recibo_honorarios',vars={'uuid':uuid},scheme='https',host=True)
        
out=request.env.web2py_path+'/applications/'+request.application+'/static/pdfs/'+uuid+'.pdf'
        from subprocess import call
        ret=call(['phantomjs',jsf,url,out,'Letter'])
        pdf=open(out,'r')
        response.headers['Content-Type']='application/pdf'
        response.headers['Content-Disposition']='attachment; 
filename='+request.vars.uuid+'.pdf'
        response.headers['Content-Title']=request.vars.uuid+'.pdf'
        return pdf.read()
        
If I run from the server:

python web2py.py -S init/controller -M

request.vars.uuid=some_uuid
recibo_pdf()

It works fine, but when I run it from the browser it takes a lot of time 
and eventually generates an Internal Error pdf. Does any body has any ideas 
how to debug this? I have search in the apache error logs and all it has is 
this:

[Sat Mar 05 17:53:31.771873 2016] [core:error] [pid 937:tid 2944346944] 
[client 127.0.0.1:34929] Script timed out before returning headers: 
wsgihandler.py



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to