Unable to use recursive=True on watch_dir for beta version with persistence
| File "/Users/johnsuh/code/internal-chat/backend/.venv/lib/python3.12/site-packages/starlette/responses.py", line 253, in wrap
| await func()
| File "/Users/johnsuh/code/internal-chat/backend/.venv/lib/python3.12/site-packages/starlette/responses.py", line 242, in stream_response
| async for chunk in self.body_iterator:
| File "/Users/johnsuh/code/internal-chat/backend/app/services/conversation_service.py", line 363, in create_message_service
| raise e
| File "/Users/johnsuh/code/internal-chat/backend/app/services/conversation_service.py", line 340, in create_message_service
| async for res in fn(db, context):
| File "/Users/johnsuh/code/internal-chat/backend/app/services/pipelines/handlers.py", line 315, in yield_agentic_anthropic
| async for response in yield_step(
| File "/Users/johnsuh/code/internal-chat/backend/app/services/pipelines/handlers.py", line 351, in yield_step
| file_watch_handler = await sandbox.files.watch_dir(
| ^^^^^^^^^^^^^^^^^^^^^^^^
| TypeError: Filesystem.watch_dir() got an unexpected keyword argument 'recursive'
on + e2b-code-interpreter==1.2.0b1
Hey @suhjohn, can you try updating to version https://pypi.org/project/e2b-code-interpreter/1.2.0b2/ ?
Amazing. Thank you
actually - I think there might be a regression unless the specs changed:
async def handle_event(event: FilesystemEvent): # type: ignore
print(f"[handlers.py::yield_step] Filesystem event: {to_json_dict(event)}") # type: ignore
await sandbox.commands.run(
f"mkdir -p /home/user/{agent_context['conversation_id']}"
)
file_watch_handler = await sandbox.files.watch_dir(
f"/home/user/{agent_context['conversation_id']}",
on_event=handle_event,
recursive=True,
)
This code used to work, but now it's not printing anything.
Actually, just figured out a way to write a version of it on my own using cli commands
Is this still an issue? Have you tried the latest beta version (1.2.0b6)?
@suhjohn , are you still experiencing the issue? I think it's been resolved, so I'll close it for now. If the problem persists, please comment, and I'll reopen it.