Problem with Werkzeug

Hi Guys ,

My custom HTML is not getting reflected in the print format and I noticed this in the terminal

11:13:11 web.1 | 127.0.0.1 - - [15/Sep/2016 11:13:11] "GET /api/method/frappe.utils.print_format.download_pdf?doctype=Purchase%20Order&name=PO-00001&format=PO&no_letterhead=0 HTTP/1.1" 200 - 11:13:11 web.1 | Error on request: 11:13:11 web.1 | Traceback (most recent call last): 11:13:11 web.1 | File "/home/ommi/frappe-bench/env/lib/python2.7/site-packages/werkzeug/serving.py", line 193, in run_wsgi 11:13:11 web.1 | execute(self.server.app) 11:13:11 web.1 | File "/home/ommi/frappe-bench/env/lib/python2.7/site-packages/werkzeug/serving.py", line 184, in execute 11:13:11 web.1 | write(data) 11:13:11 web.1 | File "/home/ommi/frappe-bench/env/lib/python2.7/site-packages/werkzeug/serving.py", line 152, in write 11:13:11 web.1 | self.send_header(key, value) 11:13:11 web.1 | File "/usr/lib/python2.7/BaseHTTPServer.py", line 401, in send_header 11:13:11 web.1 | self.wfile.write("%s: %s\r\n" % (keyword, value)) 11:13:11 web.1 | IOError: [Errno 32] Broken pipe

I restarted bench several times .

Any help guys ?

Thanks

I tried to wrap the print.py code with this , but it returns an error ,

from functools import wraps
from sys import exit, stderr, stdout
from traceback import print_exc


def suppress_broken_pipe_msg(f):
    @wraps(f)
    def wrapper(*args, **kwargs):
        try:
            return f(*args, **kwargs)
        except SystemExit:
            raise
        except:
            print_exc()
            exit(1)
        finally:
            try:
                stdout.flush()
            finally:
                try:
                    stdout.close()
                finally:
                    try:
                        stderr.flush()
                    finally:
                        stderr.close()
    return wrapper


@suppress_broken_pipe_msg
def main():

Please help

Thanks

Guys I am a python neophyte , I am trying to edit the print.py file based on the info I got from a website ,
http://coding.derkeiler.com/Archive/Python/comp.lang.python/2004-06/3823.html

which is

Actually the problem is not that Python catches SIGPIPE, but 
rather that it ignores it - as in, signal(SIGPIPE, SIG_IGN) 
Then the write returns an error 32 EPIPE, which naturally 
turns into an exception. 
To restore normal UNIX behavior, 
   import signal 
   signal.signal(signal.SIGPIPE, signal.SIG_DFL) 
And also do that after any instantiation of a socket object, 
because it happens there too. 

How to achieve this , what should I do ? i searched in google and several websites address this issue , but I am not able to find a solution , could anyone guide me please ?

Thanks

Tried the above method , but still the issue persists , upon digging further I understood the issue is with werkzeug and my issue is similar to

https://github.com/pallets/werkzeug/issues/954

Guys please help me I am not able to print anything .

Thanks

Can you share your code?

1 Like

Hi @KanchanChauhan . Many thanks for the reply , as I told earlier in my post I am a newbie , I could not figure out what I should do to come out of this issue . Please help

Thanks

Share you code so that we can take a look at it.

1 Like

Thanks for the reply @KanchanChauhan , I have not changed any code , rather I dunno where to start ? I am clueless please help.

Thanks

Custom HTML

1 Like

@Ninja

Can you please share the Procfile present in your frappe-bench or else check whether you have following entries in the file,

redis_cache: redis-server config/redis_cache.conf
redis_socketio: redis-server config/redis_socketio.conf
redis_queue: redis-server config/redis_queue.conf
web: bench serve --port 8000
watch: bench watch
socketio: /usr/local/bin/node apps/frappe/socketio.js
schedule: bench schedule
worker_short: bench worker --queue short
worker_long: bench worker --queue long
worker_default: bench worker --queue default
1 Like

Yes @KanchanChauhan I do have a custom HTML .

Many thanks for reply @shreyasp . How do I check the procfile present in the frappe-bench folder . Could you guide me please

Thanks

There is file named Procfile in the frappe-bench folder. You can check the contents by executing following command

<$Your/Server/Prompt>cat Procfile