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

Alain Poirier alain.poirier at net-ng.com
Fri Apr 22 05:20:19 EDT 2005


Le Vendredi 22 Avril 2005 06:24, vous avez écrit :
> 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

Oups, it seems I inverted my diff comparaison. Sorry.

> 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.

Right. Into the current peak code, the comparaison is `if v<>errno.ENOENT`.
I changed it by `if v.errno<>errno.ENOENT`.

> What platform are you on? 

Linux 2.6, Python 2.4.




More information about the PEAK mailing list