[PEAK] Socket existence probleme (`v.errno` instead of `v`)

Phillip J. Eby pje at telecommunity.com
Fri Apr 22 00:24:03 EDT 2005


At 06:40 PM 04/21/2005 +0200, Alain Poirier wrote:
>Hi,
>
>Playing with FastCGI (and lighttpd), I found a problem in the
>test for the existence of the unix socket.
>
>I needed to make this patch :
>
>--- /usr/lib/python2.4/site-packages/peak/net/sockets.py 2005-04-19
>13:17:26.000000000 +0200
>+++ /home/apr/projects/peak/dev/src/peak/net/sockets.py 2004-07-06
>01:41:50.000000000 +0200
>@@ -53,7 +53,7 @@
>                      try:
>                          os.unlink(sa)   # remove the existing unix socket
>                      except OSError,v:
>-                        if v.errno<>errno.ENOENT: # ignore if socket
>doesn't exist
>+                        if v<>errno.ENOENT: # ignore if socket doesn't
>exist
>                              raise
>                  s.bind(sa)
>                  s.listen(5) # should will be made configurable

I find that odd, to say the least; on both Windows and Linux, Python 2.3 
and 2.4 both end up with 'v' being an OSError instance having an 'errno' 
attribute equalling ENOENT, when os.unlink is called on a nonexistent 
filename.  What platform are you on?




More information about the PEAK mailing list