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
Hello, I'm trying to write many files multi-threaded to a directory, but as soon as there are more than 1 threads, copying does not occur. Can this be done somehow?
with ThreadPoolExecutor(max_workers=os.cpu_count()) as executor:
results = executor.map(lambda file_path: function(smb_client,
share_name,
file_path_local=file_path,
file_path_remote=file_path_remote), items, timeout=120)
def write_file(self, share_name: str, file_path_local: str, file_path_remote: str, ) -> None:
with open(file_path_local, 'rb') as file:
file_name = pathlib.Path(file_path_local).name
self.conn.storeFile(share_name, str(pathlib.PurePosixPath(file_path_remote, file_name)), file)
print(f'file {file_name} was copied')
The text was updated successfully, but these errors were encountered:
My suggestion is to create one pysmb instance for each thread, so each thread will use its own pysmb instance (and underlying SMB connection) to perform your file transfer operation.
Hello, I'm trying to write many files multi-threaded to a directory, but as soon as there are more than 1 threads, copying does not occur. Can this be done somehow?
The text was updated successfully, but these errors were encountered: