Ronald Oussoren added the comment:
WindowsError is not part of the documented interface of shutil, but is an
implementation detail.
"from shutil import WindowsUtil" works on Unix platforms because shutil
contains a compatibility definition:
try:
WindowsError
except NameError:
WindowsError = None
shutil.copytree uses this to ignore some errors on Windows (that is, uses "if
WindowsError is not None and isinstance(exc, WindowsError): ...").
Note that in 3.4 shutil does not export WindowsError at all, it uses a
different way to suppress errors in copytree.
In a perfect world the code would have used:
try:
_WindowsError = WindowsError
except NameError:
_WindowsError = None
This would have avoided accidently exporting WindowsError on Unix platforms. I
don't think it is worthwhile to do this change in a bugfix release though.
----------
nosy: +ronaldoussoren
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue18525>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com