[issue18525] Shutil cannot import WindowsError on windows

2013-07-22 Thread Christian Heimes
Christian Heimes added the comment: Please open an interactive interpreter shell and show us the output of import shutil print shutil.__file__ print dir(shutil) -- nosy: +christian.heimes ___ Python tracker rep...@bugs.python.org

[issue18525] Shutil cannot import WindowsError on windows

2013-07-22 Thread Saurabh Gupta
Saurabh Gupta added the comment: import shutil shutil.__file__ 'C:\\Python26\\lib\\shutil.pyc' dir(shutil) ['Error', '__all__', '__builtins__', '__doc__', '__file__', '__name__', '__package__', '_basename', '_samefile', 'abspath', 'copy', 'copy2', 'copyfile', 'copyfileobj', 'copymode',

[issue18525] Shutil cannot import WindowsError on windows

2013-07-22 Thread Saurabh Gupta
Saurabh Gupta added the comment: And, the same thing on linux: import shutil print shutil.__file__ /software/package/linux64_centos6/python/2.6.7/lib/python2.6/shutil.pyc print dir(shutil) ['Error', 'WindowsError', '__all__', '__builtins__', '__doc__', '__file__', '__n ame__', '__package__',

[issue18525] Shutil cannot import WindowsError on windows

2013-07-22 Thread Christian Heimes
Christian Heimes added the comment: Seems legit ... I don't have access to a Windows system right now so I can't test it. WindowsError is globally available on Windows. You don't have to import it from shutil. Portable application should use OSError instead of WindowsError. WindowsError is a

[issue18525] Shutil cannot import WindowsError on windows

2013-07-22 Thread Saurabh Gupta
Saurabh Gupta added the comment: I have a legacy software that has things like: try: some stuff except OSError, why: if WindowsError is not None and isinstance(why, WindowsError): do something else: do something else So I'd ideally like

[issue18525] Shutil cannot import WindowsError on windows

2013-07-22 Thread Ronald Oussoren
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:

[issue18525] Shutil cannot import WindowsError on windows

2013-07-22 Thread Tim Golden
Tim Golden added the comment: Really this should be a wont-fix: the fact that it's possible to import WindowsError from shutil (on Linux) is an accident of its internal implementation. It's certainly not documented as such. Saurabh: WindowsError is a builtin on Windows. If you want to mimic

[issue18525] Shutil cannot import WindowsError on windows

2013-07-22 Thread Ronald Oussoren
Ronald Oussoren added the comment: I agree that this should be closed. -- resolution: - wont fix status: open - closed versions: +Python 2.7, Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18525

[issue18525] Shutil cannot import WindowsError on windows

2013-07-22 Thread Saurabh Gupta
Saurabh Gupta added the comment: Thank you all for your inputs! Now I understand what the issue really is would be fixing it by removing the imports in the legacy software. I agree with the won't fix resolution of the ticket. -- ___ Python tracker

[issue18525] Shutil cannot import WindowsError on windows

2013-07-21 Thread Saurabh Gupta
New submission from Saurabh Gupta: I've observed that shutil fails to import WindowsError on our windows 7 systems: from shutil import WindowsError File file, line no, in module from shutil import WindowsError ImportError: cannot import name WindowsError The same statement