e2b-dev / E2B

Secure open source cloud runtime for AI apps & AI agents
https://e2b.dev/docs
Apache License 2.0
6.63k stars 422 forks source link

[E2B-442] Using `sandbox.download_file` on an empty file throws error #256

Closed ValentaTomas closed 7 months ago

ValentaTomas commented 9 months ago

When you try to download an empty file from the sandbox you will get an error:

from e2b import CodeInterpreter

sandbox = CodeInterpreter()
sandbox.cwd = "/home"  

proc2 = sandbox.process.start("sudo touch /home/file.txt",on_stdout=print,on_stderr=print)
proc2.wait()
process_cwd = sandbox.process.start("ls",on_stdout=print,on_stderr=print)
file_in_bytes = sandbox.download_file("/home/file.txt")  

with open("file.txt", "wb") as f:  
    f.write(file_in_bytes) 
Exception: Failed to download file '/home/file.txt'. Internal Server Error Error reading file: EOF

sandbox.filesystem.read should work without problems until we fix the file download.

E2B-442

ValentaTomas commented 9 months ago

We should check if the upload_file works with empty files too.

vaibhavard commented 8 months ago

Still this issue persists

jakubno commented 7 months ago

This should be fixed, but you'll have to rebuild your sandbox template if you have any.