What is OSerror in python? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
0

What is OSerror in python?

30th Aug 2018, 5:10 PM
Purvi Reddy
Purvi Reddy - avatar
4 Respostas
+ 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