You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For large sized files, 'FileCreatedEvent' is triggered when the file first appears in the directory.
If we try to read that, we will get file corrupted exception as the file is not yet copied completely.
The workaround what we can do is checking the file size continuously in a loop and once the size is stable, we can continue with the process:
file_size = 0
while file_size != os.path.getsize(event.src_path):
file_size = os.path.getsize(event.src_path)
time.sleep(1)
I'm not feeling this solution is a perfect one.
The text was updated successfully, but these errors were encountered:
For large sized files, 'FileCreatedEvent' is triggered when the file first appears in the directory.
If we try to read that, we will get file corrupted exception as the file is not yet copied completely.
The workaround what we can do is checking the file size continuously in a loop and once the size is stable, we can continue with the process:
file_size = 0
while file_size != os.path.getsize(event.src_path):
file_size = os.path.getsize(event.src_path)
time.sleep(1)
I'm not feeling this solution is a perfect one.
The text was updated successfully, but these errors were encountered: