njanakiev/folderstats

Failure in generating a checksum when file permissions are user rw only.

Closed this issue · 1 comments

Traceback (most recent call last):
...
df = folderstats.folderstats(rootfolder, hash_name='md5', ignore_hidden=False, ignore_links=True, verbose=False)
File "/home/fish/tools/python/folderstats/init.py", line 131, in folderstats
verbose=verbose)
File "/home/fish/tools/python/folderstats/init.py", line 65, in _recursive_folderstats
ignore_hidden, ignore_links, depth + 1, idx, current_idx, verbose)
File "/home/fish/tools/python/folderstats/init.py", line 65, in _recursive_folderstats
ignore_hidden, ignore_links, depth + 1, idx, current_idx, verbose)
File "/home/fish/tools/python/folderstats/init.py", line 65, in _recursive_folderstats
ignore_hidden, ignore_links, depth + 1, idx, current_idx, verbose)
File "/home/fish/tools/python/folderstats/init.py", line 94, in _recursive_folderstats
item.append(calculate_hash(filepath, hash_name))
File "/home/fish/tools/python/folderstats/init.py", line 18, in calculate_hash
with open(filepath, 'rb') as f:
PermissionError: [Errno 13] Permission denied: '/data/project/home/p72485/lodge12/.topcap_pl.tcl.swp'
df = folderstats.folderstats(rootfolder, hash_name='md5', ignore_hidden=False, ignore_links=True, verbose=False)
File "/home/fish/tools/python/folderstats/init.py", line 131, in folderstats
verbose=verbose)
File "/home/fish/tools/python/folderstats/init.py", line 65, in _recursive_folderstats
ignore_hidden, ignore_links, depth + 1, idx, current_idx, verbose)
File "/home/fish/tools/python/folderstats/init.py", line 65, in _recursive_folderstats
ignore_hidden, ignore_links, depth + 1, idx, current_idx, verbose)
File "/home/fish/tools/python/folderstats/init.py", line 65, in _recursive_folderstats
ignore_hidden, ignore_links, depth + 1, idx, current_idx, verbose)
File "/home/fish/tools/python/folderstats/init.py", line 94, in _recursive_folderstats
item.append(calculate_hash(filepath, hash_name))
File "/home/fish/tools/python/folderstats/init.py", line 18, in calculate_hash
with open(filepath, 'rb') as f:
PermissionError: [Errno 13] Permission denied: '/data/project/home/p72485/lodge12/.topcap_pl.tcl.swp'

-rw------- 1 lodge a47723 1228 Apr 4 06:58 /data/project/home/p72485/lodge12/.topcap_pl.tcl.swp

Thanks for the issue, @cgorzek! Your issue seems to be because your current user has no permission to read this file. I was not able to reproduce this error while using the same user. Although PermissionError cases are something that should be covered in future.