Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
EnvironmentError is the base class for errors that come from outside of Python (the operating system, filesystem, etc.). EnvironmentError Exception is a subclass of the StandarError class. It is the base class for IOError and OSError exceptions. It is not actually raised unlike its subclass errors like IOError and OSError.
Any example of an IOError or OSError should be an example of Environment Error as well.
import sys
try:
f = open ( "JohnDoe.txt", 'r' )
except Exception as e:
print e
print sys.exc_type
OUTPUT
[Errno 2] No such file or directory: 'JohnDoe.txt'
<type 'exceptions.IOError'>