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:
shutil.copy(filename,name)
except IOError,msg:
GnomeErrorDialog(_("Error copying %s") + "\n" + msg)
GnomeErrorDialog(_("Error copying %s") % filename + "\n" + msg)
return ""
else:
@ -129,6 +129,10 @@ def scale_image(path,size):
#-------------------------------------------------------------------------
def mk_thumb(source,dest,size):
dir = os.path.dirname(dest)
source = os.path.normpath(source)
dest = os.path.normpath(dest)
try:
if not os.path.exists(dir):
os.mkdir(dir)
@ -154,7 +158,9 @@ def mk_thumb(source,dest,size):
img = ImgManip.ImgManip(source)
img.jpg_thumbnail(dest,size,size)
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
#-------------------------------------------------------------------------

View File

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