π OpenHands: AI-Driven Development
fix: check (and create if necessary) dir before write file (#1600)
ChengyangDu16400e40caa7
diff --git a/opendevin/events/action/files.py b/opendevin/events/action/files.pyindex b93563d4e7..03428c9963 100644--- a/opendevin/events/action/files.py+++ b/opendevin/events/action/files.py@@ -144,6 +144,8 @@ class FileWriteAction(Action):whole_path = resolve_path(self.path, controller.action_manager.sandbox.get_working_directory())+ if not os.path.exists(os.path.dirname(whole_path)):+ os.makedirs(os.path.dirname(whole_path))mode = 'w' if not os.path.exists(whole_path) else 'r+'try:with open(whole_path, mode, encoding='utf-8') as file: