On Tue, Nov 17, 2009 at 8:25 PM, Benjamin Kaplan <benjamin.kap...@case.edu> wrote: > On Tue, Nov 17, 2009 at 9:18 PM, Peng Yu <pengyu...@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 -- http://mail.python.org/mailman/listinfo/python-list