What is OSerror in python? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is OSerror in python?

30th Aug 2018, 5:10 PM
Purvi Reddy
Purvi Reddy - avatar
4 Answers
+ 8
When using a module's tools, etc, if it has configuration parameters, be sure to hardcode those. I had a lot of those errors pop up after running some code on a Linux machine (that was originally programmed on a Windows machine).
30th Aug 2018, 6:34 PM
Fox
Fox - avatar
+ 4
You can check here https://docs.python.org/3/library/exceptions.html
30th Aug 2018, 7:05 PM
David Ashton
David Ashton - avatar
+ 2
exception OSError¶ This exception is derived from EnvironmentError. It is raised when a function returns a system-related error (not for illegal argument types or other incidental errors). The errno attribute is a numeric error code from errno, and the strerror attribute is the corresponding string, as would be printed by the C function perror(). See the module errno, which contains names for the error codes defined by the underlying operating system. For exceptions that involve a file system path (such as chdir() or unlink()), the exception instance will contain a third attribute,filename, which is the file name passed to the function. Source: docs.python.org
30th Aug 2018, 5:22 PM
Jishu🎗💛
Jishu🎗💛 - avatar
+ 1
Also note, Python is self-documented (though not to the extent of a website). print(OSError.__doc__) Base class for I/O related errors. help("OSError") Help on class OSError in module builtins: class OSError(Exception): | Base class for I/O related errors. | | Method resolution order: | OSError | Exception | BaseException | object | ...
30th Aug 2018, 5:58 PM
Kirk Schafer
Kirk Schafer - avatar