Skip to content

Commit

Permalink
Update XDR.py
Browse files Browse the repository at this point in the history
changed fasteners to filelock
  • Loading branch information
talagayev authored Nov 22, 2024
1 parent 40251b6 commit c98a11f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions package/MDAnalysis/coordinates/XDR.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
import numpy as np
from os.path import getctime, getsize, isfile, split, join
import warnings
import fasteners
from filelock import FileLock

from . import base
from ..lib.mdamath import triclinic_box
Expand Down Expand Up @@ -121,6 +121,8 @@ class XDRBaseReader(base.ReaderBase):
Add a InterProcessLock when generating offsets
.. versionchanged:: 2.4.0
Use a direct read into ts attributes
.. versionchanged:: 2.9.0
Changed fasteners.InterProcessLock() to filelock.FileLock
"""
@store_init_arguments
def __init__(self, filename, convert_units=True, sub=None,
Expand Down Expand Up @@ -195,7 +197,7 @@ def _load_offsets(self):

# check if the location of the lock is writable.
try:
with fasteners.InterProcessLock(lock_name) as filelock:
with FileLock(lock_name) as filelock:
pass
except OSError as e:
if isinstance(e, PermissionError) or e.errno == errno.EROFS:
Expand All @@ -206,7 +208,7 @@ def _load_offsets(self):
else:
raise

with fasteners.InterProcessLock(lock_name) as filelock:
with FileLock(lock_name) as filelock:
if not isfile(fname):
self._read_offsets(store=True)
return
Expand Down

0 comments on commit c98a11f

Please sign in to comment.