mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Nicer error message when exporting a generated csv catalog to a file open in another program on windows. Fixes #1155539 (Creating a CSV)
This commit is contained in:
parent
fa1fd8d11f
commit
40c30cfe58
@ -5,7 +5,7 @@ __license__ = 'GPL v3'
|
||||
__copyright__ = '2010, Kovid Goyal <kovid@kovidgoyal.net>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
import re, os, shutil
|
||||
import re, os, shutil, errno
|
||||
|
||||
from PyQt4.Qt import QModelIndex
|
||||
|
||||
@ -93,6 +93,15 @@ class GenerateCatalogAction(InterfaceAction):
|
||||
if export_dir:
|
||||
destination = os.path.join(export_dir, '%s.%s' % (
|
||||
sanitize_file_name_unicode(job.catalog_title), job.fmt.lower()))
|
||||
try:
|
||||
shutil.copyfile(job.catalog_file_path, destination)
|
||||
|
||||
except EnvironmentError as err:
|
||||
if getattr(err, 'errno', None) == errno.EACCES: # Permission denied
|
||||
import traceback
|
||||
error_dialog(self, _('Permission denied'),
|
||||
_('Could not open %s. Is it being used by another'
|
||||
' program?')%destination, det_msg=traceback.format_exc(),
|
||||
show=True)
|
||||
return
|
||||
raise
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user