Skip to content

πŸ™Œ OpenHands: AI-Driven Development

fix file writes (#1213)

Robert Brennan2826e39056b1
diff --git a/opendevin/action/fileop.py b/opendevin/action/fileop.py
index 24a5dd1657..1530789ea3 100644
--- a/opendevin/action/fileop.py
+++ b/opendevin/action/fileop.py
@@ -84,15 +84,14 @@ class FileWriteAction(ExecutableAction):
new_file += [i + '\n' for i in insert]
new_file += [''] if self.end == -1 else all_lines[self.end:]
else:
- new_file = insert
+ new_file = [i + '\n' for i in insert]
file.seek(0)
file.writelines(new_file)
file.truncate()
- obs = f'WRITE OPERATION:\nYou have written to "{self.path}" on these lines: {self.start}:{self.end}.'
except FileNotFoundError:
raise FileNotFoundError(f'File not found: {self.path}')
- return FileWriteObservation(content=obs + ''.join(new_file), path=self.path)
+ return FileWriteObservation(content='', path=self.path)
@property
def message(self) -> str: