Ngoại lệ PythonLỗi
subprocess.CalledProcessErrorsubprocess.CalledProcessError
Một subprocess kết thúc với mã trả về khác không.
python
Nguyên nhân gây ra lỗi này
Lệnh chạy qua subprocess.check_call(), subprocess.check_output(), hoặc subprocess.run(check=True) trả về mã thoát khác không, cho thấy thất bại.
Cách sửa
Kiểm tra error.returncode và error.stderr để biết nguyên nhân thất bại. Dùng subprocess.run() không có check=True nếu muốn tự xử lý mã thoát khác không. Sửa lệnh gốc hoặc các đối số của nó.
Ví dụ
subprocess.check_call(["false"]) # CalledProcessErrorMã lỗi liên quan
Ngoại lệ PythonLỗi
pickle.UnpicklingErrorpickle.UnpicklingError
Module pickle không thể deserialize dữ liệu được cung cấp.
python
Xem chi tiết Ngoại lệ PythonLỗi
IsADirectoryErrorIsADirectoryError
Thao tác file được thực hiện trên đường dẫn là thư mục.
python
Xem chi tiết Ngoại lệ PythonLỗi
TypeError: missing required positional argumentTypeError: thiếu đối số vị trí bắt buộc
Một hàm được gọi mà không cung cấp đủ tất cả các đối số vị trí bắt buộc.
python
Xem chi tiết Ngoại lệ PythonLỗi
NotADirectoryErrorNotADirectoryError
Thao tác thư mục được thực hiện trên đường dẫn không phải thư mục.
python
Xem chi tiết Ngoại lệ PythonLỗi
FileExistsErrorFileExistsError
Thao tác thất bại vì file hoặc thư mục đã tồn tại.
python
Xem chi tiết Ngoại lệ PythonLỗi
RecursionErrorRecursionError
Đã vượt quá giới hạn độ sâu đệ quy tối đa.
python
Xem chi tiết