Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis0
What is OSerror in python?
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).
+ 4
You can check here https://docs.python.org/3/library/exceptions.html
+ 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
+ 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
| ...