Antoine Pitrou added the comment: On Unix, you can simply check the errno value:
>>> fn = "x" * 9999999 >>> try: open(fn, "r") ... except OSError as e: exc = e ... >>> exc.errno 36 >>> exc.errno == errno.ENAMETOOLONG True I don't know about Windows. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30641> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com