This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author dmiyakawa
Recipients dmiyakawa, docs@python
Date 2016-11-16.07:37:21
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1479281842.16.0.362729785805.issue28713@psf.upfronthosting.co.za>
In-reply-to
Content
https://docs.python.org/3.5/tutorial/errors.html


for arg in sys.argv[1:]:
    try:
        f = open(arg, 'r')
    except IOError:
        print('cannot open', arg)
    else:
        print(arg, 'has', len(f.readlines()), 'lines')
        f.close()


Although IOError is still available as an alias to OSError, it should not be used in the tutorial, I believe.
History
Date User Action Args
2016-11-16 07:37:22dmiyakawasetrecipients: + dmiyakawa, docs@python
2016-11-16 07:37:22dmiyakawasetmessageid: <1479281842.16.0.362729785805.issue28713@psf.upfronthosting.co.za>
2016-11-16 07:37:22dmiyakawalinkissue28713 messages
2016-11-16 07:37:21dmiyakawacreate