エラーコードポータル
PythonPythonエラーコード

OSError

OSError

別表記: EnvironmentError · IOError · WindowsError

コード OSError · Pythonが報告した問題です。

この例外は、システム関数が「ファイルが見つかりません」や「ディスクがいっぱい」などの I/O エラーを含むシステム関連のエラーを返した場合に発生します (不正な引数の型やその他の付随的エラーの場合は除きます)。 コンストラクターの 2 番目の形式では、以下で説明する対応する属性を設定します。指定しない場合、属性はデフォルトで None になります。下位互換性のために、3 つの引数が渡された場合、args 属性には最初の 2 つのコンストラクター引数の 2 タプルのみが含まれます。 以下の OS 例外で説明するように、コンストラクターは実際には OSError のサブクラスを返すことがよくあります。特定のサブクラスは、最終的な errno 値によって異なります。この動作は、OSError を直接またはエイリアス経由で構築する場合にのみ発生し、サブクラス化する場合には継承されません。

Google Translate · 自動翻訳です。専門用語や適用条件は英語の原文で確認してください。

This exception is raised when a system function returns a system-related error, including I/O failures such as “file not found” or “disk full” (not for illegal argument types or other incidental errors). The second form of the constructor sets the corresponding attributes, described below. The attributes default to None if not specified. For backwards compatibility, if three arguments are passed, the args attribute contains only a 2-tuple of the first two constructor arguments. The constructor often actually returns a subclass of OSError, as described in OS exceptions below. The particular subclass depends on the final errno value. This behaviour only occurs when constructing OSError directly or via an alias, and is not inherited when subclassing.

トラブルシューティング・診断リンク

まず、文書の製品・バージョン・発生環境が現在の状況と一致しているか確認してください。