[MERGE] Fix a regression on Windows which doesn't allow listing the empty list of files in a file

Mark Hammond mhammond at skippinet.com.au
Sat Aug 9 06:37:41 BST 2008


Ack - this is a dupe for the other thread I started (although I picked up
one more error) - I should have made sure I caught up with mail before
sending...

John writes:

> >>> e
> WindowsError(267, 'The directory name is invalid')
> >>> e.errno
> 22
> >>> e.winerror
> 267
> 
> Interestingly enough 22 == ENOTDIR

Not for me on Windows:

>>> errno.ENOTDIR
20
>>> errno.EINVAL
22

> So we might be able to get away with:
> 
> except (OSError, WindowsError), e:

Note that EnvironmentError is also suitable - it's a base for WindowsError,
OSError and even IOError.

> I believe some versions of python changed the meaning of
> WindowsError.errno, but the latest releases of 2.4 and 2.5 both use
> errno == POSIX errno, and winerrno = windows error code.

subtly, I don't think they promise POXIS errnos, just the errno set by the
CRT - so we are still at the whim of MS.  The CRT even documents errno is
set to EINVAL in some cases.

Cheers,

Mark.




More information about the bazaar mailing list