Skip to content

Commit

Permalink
Fix file not found error in file_ops.py
Browse files Browse the repository at this point in the history
  • Loading branch information
SmartManoj committed Oct 19, 2024
1 parent 1fac6a5 commit c7c56bd
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion openhands/runtime/plugins/agent_skills/file_ops/file_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ def _check_current_file(file_path: str | None = None) -> bool:
file_path = CURRENT_FILE
if not file_path or not os.path.isfile(file_path):
return _output_error('No file open. Use the open_file function first.')
if not os.path.exists(file_path):
return _output_error(f'File {file_path} not found.')
return True


Expand Down Expand Up @@ -122,7 +124,8 @@ def _print_window(
file_path, targeted_line, window, return_str=False, ignore_window=False
):
global CURRENT_LINE
_check_current_file(file_path)
if not _check_current_file(file_path):
return
with open(file_path) as file:
content = file.read()

Expand Down

0 comments on commit c7c56bd

Please sign in to comment.