[MERGE][0.15] handle ERROR_DIRECTORY for win32 "bzr status filename"

John Arbash Meinel john at arbash-meinel.com
Tue Mar 20 02:02:38 GMT 2007


Andrew Bennetts wrote:
> John Arbash Meinel wrote:
> [...]
>> We are fortunate that WindowsError is a child of OSError. I'm also not
>> sure how Wouter's patch was working, since I can't find an e.winerror
>> member. Maybe it is a python2.5 versus 2.4 thing.
> 
> Yes, the winerror attribute is new in 2.5 (but has the same value as the errno
> attribute in 2.4, and errno in 2.5 now has a value corresponding to errno.h).
> This is likely to mean that working with both 2.5 and 2.4 is a little awkward.
> 
> -Andrew.
> 
> 

Well, if 2.5 has a value from errno.h (like ENOTDIR) it will work just
fine. If it has something like None, then we have to worry.

The other possibility is to use

e_errno = getattr(e, 'errno', None)
e_winerror = getattr(e, 'winerror', None)

if e_errno in (...) or e_winerror in (...)

Something like that should make it reasonably easy, but I would need
someone to test a bit to see what actual errors python 2.5 is raising.

John
=:->




More information about the bazaar mailing list