Pythonエラー
エラー解決
IsADirectoryError: [Errno 21] Is a directory の原因と解決法
IsADirectoryError: [Errno 21] Is a directory の原因と具体的な解決手順をまとめました。
エラーメッセージ(全文)
IsADirectoryError: [Errno 21] Is a directory
このエラーとは
IsADirectoryError: [Errno 21] Is a directory は Python 開発でよく遭遇するエラーです。
想定環境: Windows / macOS / Linux
よく出る状況: ファイルのつもりでディレクトリを開いた
よくある原因
- ファイルのつもりでディレクトリを開いた
解決方法
方法1: エラー種別に応じた修正
メッセージに含まれるファイル名・行番号・型名を手がかりに修正します.
それでも直らないとき
バージョン情報(Python のバージョン、OS、実行コマンド)を添えて、エラーメッセージ全文と直前に変更した点を確認してください。ログの数行上にも原因の手がかりが残っていることが多いです。
まとめ
「IsADirectoryError: [Errno 21] Is a directory」は ファイルのつもりでディレクトリを開いた が原因のことが多いです。上記の手順で切り分けてください。
次にやること
同じ Python カテゴリの関連エラーもあわせて確認してください。
よくある質問
IsADirectoryError: [Errno 21] Is a directory とは何ですか?
IsADirectoryError: [Errno 21] Is a directory は Python 実行時に表示されるエラーです。ファイルのつもりでディレクトリを開いた
IsADirectoryError: [Errno 21] Is a directory の原因は?
ファイルのつもりでディレクトリを開いた。
IsADirectoryError: [Errno 21] Is a directory の直し方は?
エラー種別に応じた修正:メッセージに含まれるファイル名・行番号・型名を手がかりに修正します.
Python で IsADirectoryError が出るのはなぜ?
ファイルのつもりでディレクトリを開いた
IsADirectoryError: [Errno 21] Is a directory を防ぐには?
。
次に読むべき記事
- NotADirectoryError: [Errno 20] Not a directory の原因と解決法
- urllib.error.URLError: <urlopen error [Errno 11001] getaddrinfo failed> の原因と解決法
- requests.exceptions.ConnectionError: HTTPSConnectionPool(host='api-1.example.com', port=443): Max retries exceeded の原因と解決法
- IsADirectoryError: [Errno 21] Is a directory: '/home/user/project_281' の原因と解決法
- IsADirectoryError: [Errno 21] Is a directory: '/home/user/project_262' の原因と解決法
同カテゴリ「Pythonエラー」の記事
- PermissionError: [Errno 13] Permission denied: '/tmp/app_279.lock' の原因と解決法
- PermissionError: [Errno 13] Permission denied: '/tmp/app_260.lock' の原因と解決法
- PermissionError: [Errno 13] Permission denied: '/tmp/app_241.lock' の原因と解決法
- PermissionError: [Errno 13] Permission denied: '/tmp/app_222.lock' の原因と解決法
- PermissionError: [Errno 13] Permission denied: '/tmp/app_203.lock' の原因と解決法
- PermissionError: [Errno 13] Permission denied: '/tmp/app_184.lock' の原因と解決法
人気記事
- TS2307: Cannot find module '@components/Widget601' or its corresponding type declarations の原因と解決法
- TS2307: Cannot find module '@components/Widget591' or its corresponding type declarations の原因と解決法
- TS2307: Cannot find module '@components/Widget581' or its corresponding type declarations の原因と解決法
- TS2307: Cannot find module '@components/Widget571' or its corresponding type declarations の原因と解決法
- TS2307: Cannot find module '@components/Widget561' or its corresponding type declarations の原因と解決法
- TS2307: Cannot find module '@components/Widget551' or its corresponding type declarations の原因と解決法
学習ルート
体系的に学びたい方はこちらから。
エラー・トラブル集で続きを探す →あわせて読みたい
- IsADirectoryError: [Errno 21] Is a directory: '/home/user/project_281' の原因と解決法同カテゴリの関連エラー
- IsADirectoryError: [Errno 21] Is a directory: '/home/user/project_262' の原因と解決法同カテゴリの関連エラー
- IsADirectoryError: [Errno 21] Is a directory: '/home/user/project_243' の原因と解決法同カテゴリの関連エラー
- IsADirectoryError: [Errno 21] Is a directory: '/home/user/project_224' の原因と解決法同カテゴリの関連エラー
- IsADirectoryError: [Errno 21] Is a directory: '/home/user/project_205' の原因と解決法同カテゴリの関連エラー