catch some more exceptions

svn: r5201
This commit is contained in:
Martin Hawlisch 2005-09-16 20:11:47 +00:00
parent 59e55950a6
commit 50df33736a

View File

@ -335,6 +335,7 @@ class MapView(PageView.PageView):
# For debugging: Reads in location from xearth # For debugging: Reads in location from xearth
def get_xearth_markers(self): def get_xearth_markers(self):
data = [] data = []
try:
f = open("/etc/xearth/xearth.markers") f = open("/etc/xearth/xearth.markers")
l = f.readline() l = f.readline()
#linere = re.compile('[^0-9.-]*(-?[0-9]+\.[0-9]+)[^0-9.-]*(-?[0-9]+\.[0-9]+).*"([^"])".*', "I") #linere = re.compile('[^0-9.-]*(-?[0-9]+\.[0-9]+)[^0-9.-]*(-?[0-9]+\.[0-9]+).*"([^"])".*', "I")
@ -345,6 +346,8 @@ class MapView(PageView.PageView):
if len(m) == 3: if len(m) == 3:
data.append( (m[2],float(m[1]),float(m[0]))) data.append( (m[2],float(m[1]),float(m[0])))
l = f.readline() l = f.readline()
except IOError:
pass
return data return data
# Reads in locations from current GRAMPS database # Reads in locations from current GRAMPS database
@ -365,8 +368,8 @@ class MapView(PageView.PageView):
def parse_nima_countryfile(self, filename): def parse_nima_countryfile(self, filename):
import csv import csv
data = [] data = []
csvreader = csv.reader(open(filename), "excel-tab")
try: try:
csvreader = csv.reader(open(filename), "excel-tab")
l = csvreader.next() # skip header l = csvreader.next() # skip header
l = csvreader.next() l = csvreader.next()
line = 1 line = 1
@ -380,7 +383,7 @@ class MapView(PageView.PageView):
data.append( (city, lon, lat)) data.append( (city, lon, lat))
l = csvreader.next() l = csvreader.next()
line = line + 1 line = line + 1
except StopIteration: except (IOError,StopIteration):
pass pass
return data return data