Fix #3861 (calibre locks zip file when plugin not found)

This commit is contained in:
Kovid Goyal 2009-10-25 09:08:58 -06:00
parent 712e082dc4
commit 90414033ca

View File

@ -3,6 +3,7 @@ __license__ = 'GPL v3'
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
import os, shutil, traceback, functools, sys, re
from contextlib import closing
from calibre.customize import Plugin, FileTypePlugin, MetadataReaderPlugin, \
MetadataWriterPlugin
@ -51,7 +52,7 @@ def load_plugin(path_to_zip_file):
#print 'Loading plugin from', path_to_zip_file
if not os.access(path_to_zip_file, os.R_OK):
raise PluginNotFound
zf = ZipFile(path_to_zip_file)
with closing(ZipFile(path_to_zip_file)) as zf:
for name in zf.namelist():
if name.lower().endswith('plugin.py'):
locals = {}