Closed dungdao191299 closed 1 year ago
By default SMB doesn't open the file with any FileShare flags which means it's opened exclusively and no other application can open their own handle. Luckily there is the share_access
kwarg on smbclient.open_file
https://github.com/jborean93/smbprotocol/blob/1ea33abd58f2e3886220a10888608052bf3608c1/src/smbclient/_os.py#L362-L368. You can use this to specify access types that other applications can open the file with at the same time.
For example share_access='r'
will allow other applications to open the file with Read access and also read from the file. They will won't be able to open it with Write or Delete access. You can use w
or d
respectively for that, you can even specify 2 or all 3 together if you wish to give more than just one. In the end you are the one that needs to decide what type of access you wish to allow other applications to open the file with and handle that accordingly.
I use smb lib for my project: read a data file (.met file) and process data was stored in that file. That process take about 20 minutes. But that file is sill updating more data by other application ( update every minute). So in 20 minutes processing, that application cant update any data to that file and data will be lost in that 20 minutes. Do you have any solution for that problem? Sorry for my bad english