I got the „OSError: [Errno 13] Permission denied“ after made a software update on my Synology DS211 NAS. Before calibre worked perfect for years in my single user environment.
I debugged the source code and found these lines in filenames.py:
# try:
# windows_hardlink(path, dest)
# return
# except:
# pass
…
def windows_hardlink(src, dest):
import win32file, pywintypes
try:
win32file.CreateHardLink(dest, src)
except pywintypes.error as e:
msg = u'Creating hardlink from %s to %s failed: %%s' % (src, dest)
raise Exception(msg % e)
src_size = os.path.getsize(src)
# We open and close dest, to ensure its directory entry is updated
# see
http://blogs.msdn.com/b/oldnewthing/.../10251026.aspx
for i in range(10):
# If we are on a network filesystem, we have to wait for some indeterminate time, since
# network file systems are the best thing since sliced bread
try:
if windows_get_size(dest) == src_size:
return
except EnvironmentError:
pass
time.sleep(0.3)
For me it’s a bit weird to use a hardlink on a linux/samba based fileserver. I downloaded the calibre source from
http://calibre-ebook.com/get-involved and switched to development mode as described in
http://manual.calibre-ebook.com/develop.html. I commented out windows_hardlink call. Calibre 2 now works perfect again without any errors when importing or moving books.