[PEAK] peak lanuch and freebsd

Phillip J. Eby pje at telecommunity.com
Mon Nov 1 19:49:14 EST 2004

At 05:48 PM 11/1/04 -0500, R. David Murray wrote:
>When I run peak lanuch on my machine (FreeBSD 5.2.1), the web browser
>(w3m) hangs waiting for an answer.  If I run peak serve, figure
>out the port number, and connect from another window, I can
>see the page (I'm running the CGI demo for the moment).  Am
>I doing something wrong?  I just did:
>PYTHONPATH=/usr/local/src/PEAK/examples/trivial_cgi peak launch 
>When I ctl-C the command, the traceback looks like this:
>Traceback (most recent call last):
>   File "/usr/local/lib/python2.4/site-packages/wsgiref/handlers.py", line 
> 93, in run
>     self.finish_response()
>   File "/usr/local/lib/python2.4/site-packages/wsgiref/handlers.py", line 
> 134, in finish_response
>     self.write(data)
>   File "/usr/local/lib/python2.4/site-packages/wsgiref/handlers.py", line 
> 217, in write
>     self.send_headers()
>   File "/usr/local/lib/python2.4/site-packages/wsgiref/handlers.py", line 
> 273, in send_headers
>     self.send_preamble()
>   File "/usr/local/lib/python2.4/site-packages/wsgiref/handlers.py", line 
> 198, in send_preamble
>     self._write(
>   File "/usr/local/lib/python2.4/socket.py", line 256, in write
>     self.flush()
>   File "/usr/local/lib/python2.4/socket.py", line 243, in flush
>     self._sock.sendall(buffer)
>error: (32, 'Broken pipe')
>I have to ctl-C it a second time to get back to the prompt.
>This reminds me of a problem I had with Zope unit tests several years ago,
>but the details are really fuzzy.  That one was FreeBSD specific, I think,
>which is why I mention the OS here....

It sounds to me like maybe Python is waiting for w3m to finish before it 
starts the web server.  The 'webbrowser' module just does the equivalent of:

      os.system("w3m http://localhost:2854/")

So if 'w3m' doesn't fork off another process at that point, it's going to 
be hosed in a way much like what you describe.  Try setting:

      BROWSER="w3m %s &"

and run peak launch.  I think this might be needed for certain Unix browsers.

More information about the PEAK mailing list