* src/ArgHandler.py: Use sys.exit() for bailing out.
* src/GrampsDb/_ReadXML.py (start_url): Correctly parse url type; Use sys.ext() for bailing out. svn: r8567
This commit is contained in:
parent
54e4e74ef4
commit
ba04168159
@ -1,6 +1,8 @@
|
|||||||
2007-06-16 Alex Roitman <shura@gramps-project.org>
|
2007-06-16 Alex Roitman <shura@gramps-project.org>
|
||||||
* src/GrampsDb/_ReadXML.py (start_url): Correctly parse url type.
|
* src/ArgHandler.py: Use sys.exit() for bailing out.
|
||||||
|
* src/GrampsDb/_ReadXML.py (start_url): Correctly parse url type;
|
||||||
|
Use sys.ext() for bailing out.
|
||||||
|
|
||||||
2007-06-16 Brian Pepple <bpepple@fedoraproject.org>
|
2007-06-16 Brian Pepple <bpepple@fedoraproject.org>
|
||||||
* data/gramps.desktop.in: Fix desktop file to conform to desktop
|
* data/gramps.desktop.in: Fix desktop file to conform to desktop
|
||||||
file specs.
|
file specs.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# Gramps - a GTK+/GNOME based genealogy program
|
# Gramps - a GTK+/GNOME based genealogy program
|
||||||
#
|
#
|
||||||
# Copyright (C) 2000-2006 Donald N. Allingham
|
# Copyright (C) 2000-2007 Donald N. Allingham
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@ -112,7 +112,7 @@ class ArgHandler:
|
|||||||
"""
|
"""
|
||||||
Fill in lists with open, exports, imports, and actions options.
|
Fill in lists with open, exports, imports, and actions options.
|
||||||
|
|
||||||
Any parsing errors lead to abort via os._exit(1).
|
Any parsing errors lead to abort via sys.exit().
|
||||||
"""
|
"""
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -120,8 +120,8 @@ class ArgHandler:
|
|||||||
const.shortopts,const.longopts)
|
const.shortopts,const.longopts)
|
||||||
except getopt.GetoptError:
|
except getopt.GetoptError:
|
||||||
# return without filling anything if we could not parse the args
|
# return without filling anything if we could not parse the args
|
||||||
print "Error parsing arguments: %s " % self.args[1:]
|
msg = "Error parsing arguments: %s " % self.args[1:]
|
||||||
os._exit(1)
|
sys.exit(msg)
|
||||||
|
|
||||||
if leftargs:
|
if leftargs:
|
||||||
# if there were an argument without option,
|
# if there were an argument without option,
|
||||||
@ -322,8 +322,8 @@ class ArgHandler:
|
|||||||
_("New GRAMPS database was not set up"),
|
_("New GRAMPS database was not set up"),
|
||||||
_('GRAMPS cannot open non-native data '
|
_('GRAMPS cannot open non-native data '
|
||||||
'without setting up new GRAMPS database.'))
|
'without setting up new GRAMPS database.'))
|
||||||
print "Cannot continue without native database. Exiting..."
|
msg = "Cannot continue without native database. Exiting..."
|
||||||
os._exit(1)
|
sys.exit(msg)
|
||||||
elif filetype == const.app_gramps_package:
|
elif filetype == const.app_gramps_package:
|
||||||
print "Type: GRAMPS package"
|
print "Type: GRAMPS package"
|
||||||
self.vm.import_pkg(filename)
|
self.vm.import_pkg(filename)
|
||||||
@ -335,14 +335,14 @@ class ArgHandler:
|
|||||||
_('File type "%s" is unknown to GRAMPS.\n\n'
|
_('File type "%s" is unknown to GRAMPS.\n\n'
|
||||||
'Valid types are: GRAMPS database, GRAMPS XML, '
|
'Valid types are: GRAMPS database, GRAMPS XML, '
|
||||||
'GRAMPS package, and GEDCOM.') % filetype)
|
'GRAMPS package, and GEDCOM.') % filetype)
|
||||||
print "Exiting..."
|
msg = "Exiting..."
|
||||||
os._exit(1)
|
sys.exit(msg)
|
||||||
if success:
|
if success:
|
||||||
# Add the file to the recent items
|
# Add the file to the recent items
|
||||||
#RecentFiles.recent_files(filename,filetype)
|
#RecentFiles.recent_files(filename,filetype)
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
os._exit(1)
|
sys.exit("There was an error")
|
||||||
return
|
return
|
||||||
|
|
||||||
if self.open:
|
if self.open:
|
||||||
@ -366,18 +366,16 @@ class ArgHandler:
|
|||||||
filetype = const.app_gramps_xml
|
filetype = const.app_gramps_xml
|
||||||
print "Type: GRAMPS XML"
|
print "Type: GRAMPS XML"
|
||||||
else:
|
else:
|
||||||
print "Unknown file type: %s" % format
|
msg = "Unknown file type: %s. Exiting..." % format
|
||||||
print "Exiting..."
|
sys.exit(msg)
|
||||||
os._exit(1)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.vm.read_recent_file(filename,filetype)
|
self.vm.read_recent_file(filename,filetype)
|
||||||
print "Opened successfully!"
|
print "Opened successfully!"
|
||||||
success = True
|
success = True
|
||||||
except:
|
except:
|
||||||
print "Error opening the file."
|
msg = "Error opening the file. Exiting..."
|
||||||
print "Exiting..."
|
sys.exit(msg)
|
||||||
os._exit(1)
|
|
||||||
|
|
||||||
if self.imports:
|
if self.imports:
|
||||||
self.cl = bool(self.exports or self.actions or self.cl)
|
self.cl = bool(self.exports or self.actions or self.cl)
|
||||||
@ -389,13 +387,13 @@ class ArgHandler:
|
|||||||
try:
|
try:
|
||||||
os.mkdir(self.impdir_path,0700)
|
os.mkdir(self.impdir_path,0700)
|
||||||
except:
|
except:
|
||||||
print "Could not create import directory %s. Exiting." \
|
msg = "Could not create import directory %s. Exiting." \
|
||||||
% self.impdir_path
|
% self.impdir_path
|
||||||
os._exit(1)
|
sys.exit(msg)
|
||||||
elif not os.access(self.impdir_path,os.W_OK):
|
elif not os.access(self.impdir_path,os.W_OK):
|
||||||
print "Import directory %s is not writable. Exiting." \
|
msg = "Import directory %s is not writable. Exiting." \
|
||||||
% self.impdir_path
|
% self.impdir_path
|
||||||
os._exit(1)
|
sys.exit(msg)
|
||||||
# and clean it up before use
|
# and clean it up before use
|
||||||
files = os.listdir(self.impdir_path) ;
|
files = os.listdir(self.impdir_path) ;
|
||||||
for fn in files:
|
for fn in files:
|
||||||
@ -431,7 +429,7 @@ class ArgHandler:
|
|||||||
if self.imports:
|
if self.imports:
|
||||||
os.remove(self.imp_db_path)
|
os.remove(self.imp_db_path)
|
||||||
print "Exiting."
|
print "Exiting."
|
||||||
os._exit(0)
|
sys.exit()
|
||||||
|
|
||||||
elif Config.get(Config.RECENT_FILE) and Config.get(Config.AUTOLOAD):
|
elif Config.get(Config.RECENT_FILE) and Config.get(Config.AUTOLOAD):
|
||||||
rf = Config.get(Config.RECENT_FILE)
|
rf = Config.get(Config.RECENT_FILE)
|
||||||
@ -447,7 +445,7 @@ class ArgHandler:
|
|||||||
def cl_import(self,filename,format):
|
def cl_import(self,filename,format):
|
||||||
"""
|
"""
|
||||||
Command-line import routine. Try to import filename using the format.
|
Command-line import routine. Try to import filename using the format.
|
||||||
Any errors will cause the os._exit(1) call.
|
Any errors will cause the sys.exit() call.
|
||||||
"""
|
"""
|
||||||
if format == 'grdb':
|
if format == 'grdb':
|
||||||
filename = os.path.normpath(os.path.abspath(filename))
|
filename = os.path.normpath(os.path.abspath(filename))
|
||||||
@ -455,8 +453,8 @@ class ArgHandler:
|
|||||||
GrampsDb.gramps_db_reader_factory(const.app_gramps)(
|
GrampsDb.gramps_db_reader_factory(const.app_gramps)(
|
||||||
self.state.db,filename,empty)
|
self.state.db,filename,empty)
|
||||||
except:
|
except:
|
||||||
print "Error importing %s" % filename
|
msg = "Error importing %s" % filename
|
||||||
os._exit(1)
|
sys.exit(msg)
|
||||||
elif format == 'gedcom':
|
elif format == 'gedcom':
|
||||||
filename = os.path.normpath(os.path.abspath(filename))
|
filename = os.path.normpath(os.path.abspath(filename))
|
||||||
try:
|
try:
|
||||||
@ -464,23 +462,23 @@ class ArgHandler:
|
|||||||
from GrampsDb._ReadGedcom import import2
|
from GrampsDb._ReadGedcom import import2
|
||||||
import2(self.state.db,filename,None,None,False)
|
import2(self.state.db,filename,None,None,False)
|
||||||
except:
|
except:
|
||||||
print "Error importing %s" % filename
|
msg = "Error importing %s" % filename
|
||||||
os._exit(1)
|
sys.exit(msg)
|
||||||
elif format == 'gramps-xml':
|
elif format == 'gramps-xml':
|
||||||
try:
|
try:
|
||||||
GrampsDb.gramps_db_reader_factory(const.app_gramps_xml)(
|
GrampsDb.gramps_db_reader_factory(const.app_gramps_xml)(
|
||||||
self.state.db,filename,None,self.cl)
|
self.state.db,filename,None,self.cl)
|
||||||
except:
|
except:
|
||||||
print "Error importing %s" % filename
|
msg "Error importing %s" % filename
|
||||||
os._exit(1)
|
sys.exit(msg)
|
||||||
elif format == 'geneweb':
|
elif format == 'geneweb':
|
||||||
import ImportGeneWeb
|
import ImportGeneWeb
|
||||||
filename = os.path.normpath(os.path.abspath(filename))
|
filename = os.path.normpath(os.path.abspath(filename))
|
||||||
try:
|
try:
|
||||||
ImportGeneWeb.importData(self.state.db,filename,None)
|
ImportGeneWeb.importData(self.state.db,filename,None)
|
||||||
except:
|
except:
|
||||||
print "Error importing %s" % filename
|
msg = "Error importing %s" % filename
|
||||||
os._exit(1)
|
sys.exit(msg)
|
||||||
elif format == 'gramps-pkg':
|
elif format == 'gramps-pkg':
|
||||||
# Create tempdir, if it does not exist, then check for writability
|
# Create tempdir, if it does not exist, then check for writability
|
||||||
tmpdir_path = os.path.join(const.home_dir,"tmp")
|
tmpdir_path = os.path.join(const.home_dir,"tmp")
|
||||||
@ -488,12 +486,12 @@ class ArgHandler:
|
|||||||
try:
|
try:
|
||||||
os.mkdir(tmpdir_path,0700)
|
os.mkdir(tmpdir_path,0700)
|
||||||
except:
|
except:
|
||||||
print "Could not create temporary directory %s" \
|
msg = "Could not create temporary directory %s" \
|
||||||
% tmpdir_path
|
% tmpdir_path
|
||||||
os._exit(1)
|
sys.exit(msg)
|
||||||
elif not os.access(tmpdir_path,os.W_OK):
|
elif not os.access(tmpdir_path,os.W_OK):
|
||||||
print "Temporary directory %s is not writable" % tmpdir_path
|
msg = "Temporary directory %s is not writable" % tmpdir_path
|
||||||
os._exit(1)
|
sys.exit(msg)
|
||||||
else: # tempdir exists and writable -- clean it up if not empty
|
else: # tempdir exists and writable -- clean it up if not empty
|
||||||
files = os.listdir(tmpdir_path) ;
|
files = os.listdir(tmpdir_path) ;
|
||||||
for fn in files:
|
for fn in files:
|
||||||
@ -506,14 +504,14 @@ class ArgHandler:
|
|||||||
archive.extract(tarinfo,tmpdir_path)
|
archive.extract(tarinfo,tmpdir_path)
|
||||||
archive.close()
|
archive.close()
|
||||||
except ReadError, msg:
|
except ReadError, msg:
|
||||||
print "Error reading archive:", msg
|
m = "Error reading archive:", msg
|
||||||
os._exit(1)
|
sys.exit(m)
|
||||||
except CompressError, msg:
|
except CompressError, msg:
|
||||||
print "Error uncompressing archive:", msg
|
m = "Error uncompressing archive:", msg
|
||||||
os._exit(1)
|
sys.exit(m)
|
||||||
except:
|
except:
|
||||||
print "Error extracting into %s" % tmpdir_path
|
m = "Error extracting into %s" % tmpdir_path
|
||||||
os._exit(1)
|
sys.exit(m)
|
||||||
|
|
||||||
dbname = os.path.join(tmpdir_path,const.xmlFile)
|
dbname = os.path.join(tmpdir_path,const.xmlFile)
|
||||||
|
|
||||||
@ -521,8 +519,8 @@ class ArgHandler:
|
|||||||
GrampsDb.gramps_db_reader_factory(const.app_gramps_xml)(
|
GrampsDb.gramps_db_reader_factory(const.app_gramps_xml)(
|
||||||
self.state.db,dbname,None)
|
self.state.db,dbname,None)
|
||||||
except:
|
except:
|
||||||
print "Error importing %s" % filename
|
msg = "Error importing %s" % filename
|
||||||
os._exit(1)
|
sys.exit(msg)
|
||||||
# Clean up tempdir after ourselves
|
# Clean up tempdir after ourselves
|
||||||
# THIS HAS BEEN CHANGED, because now we want to keep images
|
# THIS HAS BEEN CHANGED, because now we want to keep images
|
||||||
# stay after the import is over. Just delete the XML file.
|
# stay after the import is over. Just delete the XML file.
|
||||||
@ -532,8 +530,8 @@ class ArgHandler:
|
|||||||
## os.remove(os.path.join(tmpdir_path,fn))
|
## os.remove(os.path.join(tmpdir_path,fn))
|
||||||
## os.rmdir(tmpdir_path)
|
## os.rmdir(tmpdir_path)
|
||||||
else:
|
else:
|
||||||
print "Invalid format: %s" % format
|
msg = "Invalid format: %s" % format
|
||||||
os._exit(1)
|
sys.exit(msg)
|
||||||
if not self.cl:
|
if not self.cl:
|
||||||
return self.vm.post_load()
|
return self.vm.post_load()
|
||||||
|
|
||||||
@ -546,7 +544,7 @@ class ArgHandler:
|
|||||||
"""
|
"""
|
||||||
Command-line export routine.
|
Command-line export routine.
|
||||||
Try to write into filename using the format.
|
Try to write into filename using the format.
|
||||||
Any errors will cause the os._exit(1) call.
|
Any errors will cause the sys.exit() call.
|
||||||
"""
|
"""
|
||||||
filename = os.path.abspath(os.path.expanduser(filename))
|
filename = os.path.abspath(os.path.expanduser(filename))
|
||||||
if format == 'grdb':
|
if format == 'grdb':
|
||||||
@ -554,15 +552,15 @@ class ArgHandler:
|
|||||||
GrampsDb.gramps_db_writer_factory(const.app_gramps)(
|
GrampsDb.gramps_db_writer_factory(const.app_gramps)(
|
||||||
self.state.db,filename)
|
self.state.db,filename)
|
||||||
except:
|
except:
|
||||||
print "Error exporting %s" % filename
|
msg = "Error exporting %s" % filename
|
||||||
os._exit(1)
|
sys.exit(msg)
|
||||||
elif format == 'gedcom':
|
elif format == 'gedcom':
|
||||||
try:
|
try:
|
||||||
gw = GrampsDb.GedcomWriter(self.state.db,None,1,filename)
|
gw = GrampsDb.GedcomWriter(self.state.db,None,1,filename)
|
||||||
ret = gw.export_data(filename)
|
ret = gw.export_data(filename)
|
||||||
except:
|
except:
|
||||||
print "Error exporting %s" % filename
|
print "Error exporting %s" % filename
|
||||||
os._exit(1)
|
sys._xit(msg)
|
||||||
elif format == 'gramps-xml':
|
elif format == 'gramps-xml':
|
||||||
filename = os.path.normpath(os.path.abspath(filename))
|
filename = os.path.normpath(os.path.abspath(filename))
|
||||||
if filename:
|
if filename:
|
||||||
@ -570,32 +568,32 @@ class ArgHandler:
|
|||||||
g = GrampsDb.XmlWriter(self.state.db,None,0,1)
|
g = GrampsDb.XmlWriter(self.state.db,None,0,1)
|
||||||
ret = g.write(filename)
|
ret = g.write(filename)
|
||||||
except:
|
except:
|
||||||
print "Error exporting %s" % filename
|
msg = "Error exporting %s" % filename
|
||||||
os._exit(1)
|
sys.exit(msg)
|
||||||
elif format == 'gramps-pkg':
|
elif format == 'gramps-pkg':
|
||||||
try:
|
try:
|
||||||
import WritePkg
|
import WritePkg
|
||||||
writer = WritePkg.PackageWriter(self.state.db,filename)
|
writer = WritePkg.PackageWriter(self.state.db,filename)
|
||||||
ret = writer.export()
|
ret = writer.export()
|
||||||
except:
|
except:
|
||||||
print "Error creating %s" % filename
|
msg = "Error creating %s" % filename
|
||||||
os._exit(1)
|
sys.exit(msg)
|
||||||
elif format == 'iso':
|
elif format == 'iso':
|
||||||
import WriteCD
|
import WriteCD
|
||||||
try:
|
try:
|
||||||
writer = WriteCD.PackageWriter(self.state.db,filename,1)
|
writer = WriteCD.PackageWriter(self.state.db,filename,1)
|
||||||
ret = writer.export()
|
ret = writer.export()
|
||||||
except:
|
except:
|
||||||
print "Error exporting %s" % filename
|
msg = "Error exporting %s" % filename
|
||||||
os._exit(1)
|
sys.exit(msg)
|
||||||
elif format == 'wft':
|
elif format == 'wft':
|
||||||
import WriteFtree
|
import WriteFtree
|
||||||
try:
|
try:
|
||||||
writer = WriteFtree.FtreeWriter(self.state.db,None,1,filename)
|
writer = WriteFtree.FtreeWriter(self.state.db,None,1,filename)
|
||||||
ret = writer.export_data()
|
ret = writer.export_data()
|
||||||
except:
|
except:
|
||||||
print "Error exporting %s" % filename
|
msg = "Error exporting %s" % filename
|
||||||
os._exit(1)
|
sys.exit(msg)
|
||||||
elif format == 'geneweb':
|
elif format == 'geneweb':
|
||||||
import WriteGeneWeb
|
import WriteGeneWeb
|
||||||
try:
|
try:
|
||||||
@ -603,11 +601,11 @@ class ArgHandler:
|
|||||||
None,1,filename)
|
None,1,filename)
|
||||||
ret = writer.export_data()
|
ret = writer.export_data()
|
||||||
except:
|
except:
|
||||||
print "Error exporting %s" % filename
|
msg = "Error exporting %s" % filename
|
||||||
os._exit(1)
|
sys.exit(msg)
|
||||||
else:
|
else:
|
||||||
print "Invalid format: %s" % format
|
msg = "Invalid format: %s" % format
|
||||||
os._exit(1)
|
sys.exit(msg)
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -617,7 +615,7 @@ class ArgHandler:
|
|||||||
def cl_action(self,action,options_str):
|
def cl_action(self,action,options_str):
|
||||||
"""
|
"""
|
||||||
Command-line action routine. Try to perform specified action.
|
Command-line action routine. Try to perform specified action.
|
||||||
Any errors will cause the os._exit(1) call.
|
Any errors will cause the sys.exit() call.
|
||||||
"""
|
"""
|
||||||
if action == 'check':
|
if action == 'check':
|
||||||
import Check
|
import Check
|
||||||
@ -642,8 +640,8 @@ class ArgHandler:
|
|||||||
|
|
||||||
name = options_str_dict.pop('name',None)
|
name = options_str_dict.pop('name',None)
|
||||||
if not name:
|
if not name:
|
||||||
print "Report name not given. Please use name=reportname"
|
msg = "Report name not given. Please use name=reportname"
|
||||||
os._exit(1)
|
sys.exit(msg)
|
||||||
|
|
||||||
for item in cl_list:
|
for item in cl_list:
|
||||||
if name == item[0]:
|
if name == item[0]:
|
||||||
@ -672,8 +670,8 @@ class ArgHandler:
|
|||||||
|
|
||||||
name = options_str_dict.pop('name',None)
|
name = options_str_dict.pop('name',None)
|
||||||
if not name:
|
if not name:
|
||||||
print "Tool name not given. Please use name=toolname"
|
msg = "Tool name not given. Please use name=toolname"
|
||||||
os._exit(1)
|
sys.exit(msg)
|
||||||
|
|
||||||
for item in cli_tool_list:
|
for item in cli_tool_list:
|
||||||
if name == item[0]:
|
if name == item[0]:
|
||||||
@ -688,8 +686,8 @@ class ArgHandler:
|
|||||||
for item in cli_tool_list:
|
for item in cli_tool_list:
|
||||||
print " %s" % item[0]
|
print " %s" % item[0]
|
||||||
else:
|
else:
|
||||||
print "Unknown action: %s." % action
|
msg = "Unknown action: %s." % action
|
||||||
os._exit(1)
|
sys.exit(msg)
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# Gramps - a GTK+/GNOME based genealogy program
|
# Gramps - a GTK+/GNOME based genealogy program
|
||||||
#
|
#
|
||||||
# Copyright (C) 2000-2006 Donald N. Allingham
|
# Copyright (C) 2000-2007 Donald N. Allingham
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@ -26,6 +26,7 @@
|
|||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
import os
|
import os
|
||||||
|
import sys
|
||||||
import sets
|
import sets
|
||||||
import shutil
|
import shutil
|
||||||
from xml.parsers.expat import ExpatError, ParserCreate
|
from xml.parsers.expat import ExpatError, ParserCreate
|
||||||
@ -127,15 +128,14 @@ def importData(database, filename, callback=None,cl=0,use_trans=False):
|
|||||||
except IOError,msg:
|
except IOError,msg:
|
||||||
if cl:
|
if cl:
|
||||||
print "Error: %s could not be opened Exiting." % filename
|
print "Error: %s could not be opened Exiting." % filename
|
||||||
print msg
|
sys.exit(msg)
|
||||||
os._exit(1)
|
|
||||||
else:
|
else:
|
||||||
ErrorDialog(_("%s could not be opened") % filename,str(msg))
|
ErrorDialog(_("%s could not be opened") % filename,str(msg))
|
||||||
return
|
return
|
||||||
except:
|
except:
|
||||||
if cl:
|
if cl:
|
||||||
print "Error: %s could not be opened. Exiting." % filename
|
msg = "Error: %s could not be opened. Exiting." % filename
|
||||||
os._exit(1)
|
sys.exit(msg)
|
||||||
else:
|
else:
|
||||||
ErrorDialog(_("%s could not be opened") % filename)
|
ErrorDialog(_("%s could not be opened") % filename)
|
||||||
return
|
return
|
||||||
@ -144,10 +144,9 @@ def importData(database, filename, callback=None,cl=0,use_trans=False):
|
|||||||
except IOError,msg:
|
except IOError,msg:
|
||||||
if cl:
|
if cl:
|
||||||
print "Error reading %s" % filename
|
print "Error reading %s" % filename
|
||||||
print msg
|
|
||||||
import traceback
|
import traceback
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
os._exit(1)
|
sys.exit(msg)
|
||||||
else:
|
else:
|
||||||
ErrorDialog(_("Error reading %s") % filename,str(msg))
|
ErrorDialog(_("Error reading %s") % filename,str(msg))
|
||||||
import traceback
|
import traceback
|
||||||
@ -155,9 +154,9 @@ def importData(database, filename, callback=None,cl=0,use_trans=False):
|
|||||||
return
|
return
|
||||||
except ExpatError, msg:
|
except ExpatError, msg:
|
||||||
if cl:
|
if cl:
|
||||||
print "Error reading %s" % filename
|
msg = "Error reading %s" % filename
|
||||||
print "The file is probably either corrupt or not a valid GRAMPS database."
|
print "The file is probably either corrupt or not a valid GRAMPS database."
|
||||||
os._exit(1)
|
sys.exit(msg)
|
||||||
else:
|
else:
|
||||||
ErrorDialog(_("Error reading %s") % filename,
|
ErrorDialog(_("Error reading %s") % filename,
|
||||||
_("The file is probably either corrupt or not a valid GRAMPS database."))
|
_("The file is probably either corrupt or not a valid GRAMPS database."))
|
||||||
@ -1863,7 +1862,6 @@ def build_place_title(loc):
|
|||||||
return value
|
return value
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
import sys
|
|
||||||
import hotshot#, hotshot.stats
|
import hotshot#, hotshot.stats
|
||||||
from GrampsDb import gramps_db_factory
|
from GrampsDb import gramps_db_factory
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user