ValueErrorValueError
A function received an argument of the right type but an inappropriate value.
What causes this error
The argument has the correct type but an invalid value. Common examples: int('abc'), list.remove(x) where x is not in the list, math.sqrt(-1), or unpacking the wrong number of values.
How to fix it
Validate input values before passing them to functions. Use try-except around conversions. Check that values are within expected ranges. For unpacking, ensure the number of variables matches the number of values.
Example
int("abc") # ValueError: invalid literal for int()Related Error Codes
TypeError: object is not callableTypeError: object is not callable
An object that is not a function was called with parentheses ().
BufferErrorBufferError
An operation on a buffer object failed.
PermissionErrorPermissionError
The operation is not permitted due to insufficient file system permissions.
ConnectionAbortedErrorConnectionAbortedError
The connection was aborted by the local machine.
FutureWarningFutureWarning
A warning about behavior that will change in a future version.
ModuleNotFoundErrorModuleNotFoundError
Python could not find the specified module to import.