aioshutil
aioshutil copied to clipboard
aioshutil.make_archive sometimes return FileNotFoundError when concurrent request
Actually I have a restful API, it will compress folder to zip and return zip file. But if I concurrent request many different folder to compress, some request will return error like this:

My code is:

I have the same exact issue, this is due to the underlying shutil implementation, which calls os.chdir multiple times Wrapping this in a thread assumes the caller is the only one manipulating the current directory, and that is not the case when awaiting the wrapped task