WindowsError is not available on linux?

Benjamin Kaplan benjamin.kaplan at case.edu
Wed Nov 18 04:19:05 CET 2009


On Tue, Nov 17, 2009 at 9:40 PM, Peng Yu <pengyu.ut at gmail.com> wrote:
> On Tue, Nov 17, 2009 at 8:25 PM, Benjamin Kaplan
> <benjamin.kaplan at case.edu> wrote:
>> On Tue, Nov 17, 2009 at 9:18 PM, Peng Yu <pengyu.ut at gmail.com> wrote:
>>> It's not clear to me whether WindowsError is available on linux or
>>> not, after I read the document. But I see WindowsError in shutil.py.
>>> Could you somebody let me know what cause the following error?
>>>
>>>>>> try:
>>> ...   raise WindowsError('WindowsError')
>>> ... except WindowsError as e:
>>> ...   print e
>>> ...
>>> Traceback (most recent call last):
>>>  File "<stdin>", line 3, in <module>
>>> NameError: name 'WindowsError' is not defined
>>> --
>>
>> does this answer your question?
>>
>> Python 2.6.4 (r264:75706, Oct 28 2009, 23:01:00)
>> [GCC 4.2.1 (Apple Inc. build 5646) (dot 1)] on darwin
>> Type "help", "copyright", "credits" or "license" for more information.
>>>>> import shutil
>>>>> print shutil.WindowsError
>> None
>
> But the document doesn't say shutil need to be imported in order to
> use WindowsError. Shall the document or the code be corrected?
>
> http://docs.python.org/library/exceptions.html

The exception WindowsError is not defined on my computer (a Mac). The
*name* is defined in shutil, but it's mapped to None, not to an
exception.

> --
> http://mail.python.org/mailman/listinfo/python-list
>



More information about the Python-list mailing list