Error checking for PIL thumbnail

svn: r792
This commit is contained in:
Don Allingham 2002-02-23 00:59:19 +00:00
parent 77b74bf7e2
commit 2851a83522
2 changed files with 9 additions and 3 deletions

View File

@ -85,7 +85,7 @@ def import_media_object(filename,path,base):
try: try:
shutil.copy(filename,name) shutil.copy(filename,name)
except IOError,msg: except IOError,msg:
GnomeErrorDialog(_("Error copying %s") + "\n" + msg) GnomeErrorDialog(_("Error copying %s") % filename + "\n" + msg)
return "" return ""
else: else:
@ -129,6 +129,10 @@ def scale_image(path,size):
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
def mk_thumb(source,dest,size): def mk_thumb(source,dest,size):
dir = os.path.dirname(dest) dir = os.path.dirname(dest)
source = os.path.normpath(source)
dest = os.path.normpath(dest)
try: try:
if not os.path.exists(dir): if not os.path.exists(dir):
os.mkdir(dir) os.mkdir(dir)
@ -154,7 +158,9 @@ def mk_thumb(source,dest,size):
img = ImgManip.ImgManip(source) img = ImgManip.ImgManip(source)
img.jpg_thumbnail(dest,size,size) img.jpg_thumbnail(dest,size,size)
except: except:
GnomeErrorDialog(_("Could not create a thumbnail for %s") % source) import sys
msg = "%s\n%s %s" % (source,sys.exc_type,sys.exc_value)
GnomeErrorDialog(_("Could not create a thumbnail for %s") % msg)
return return
#------------------------------------------------------------------------- #-------------------------------------------------------------------------

View File

@ -31,7 +31,7 @@ try:
import StartupDialog import StartupDialog
if StartupDialog.need_to_run(): if StartupDialog.need_to_run():
StartupDialog.StartupDialog(gramps_main.main,arg) StartupDialog.StartupDialog(gramps_main.Gramps,arg)
else: else:
gramps_main.Gramps(arg) gramps_main.Gramps(arg)
except: except: