Closed ubershmekel closed 8 years ago
For reference this was the test code
import time
import os
import fasteners
fpath = 'tmp_lock_file'
open(fpath, 'w').close()
#os.mkdir(fpath)
#@fasteners.process_lock.interprocess_locked(os.path.abspath(fpath))
@fasteners.process_lock.interprocess_locked(fpath)
def test():
for i in range(5):
print('I have the lock')
time.sleep(1)
print('Waiting for lock')
test()
Seems like we should just call os.path.abspath
on all paths to ensure they are absolute, or add an option make_absolute=True
to get past this...
Or don't call _ensure_tree
when basedir
is an empty string.
Btw https://pypi.python.org/pypi/fasteners/0.14.1 use that and the fix is in there :)
Cool. Thank you :)
The problem is
dirname
hereWhich causes this exception because basedir is empty.
Honestly I'm surprised this library is trying to create the file or directory. It should just fail if the lock is missing.