Message193515
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. |
|
Date |
User |
Action |
Args |
2013-07-22 08:21:08 | ronaldoussoren | set | recipients:
+ ronaldoussoren, christian.heimes, saurabhgupta2u |
2013-07-22 08:21:08 | ronaldoussoren | set | messageid: <1374481268.52.0.881086888241.issue18525@psf.upfronthosting.co.za> |
2013-07-22 08:21:08 | ronaldoussoren | link | issue18525 messages |
2013-07-22 08:21:08 | ronaldoussoren | create | |
|