catch some more exceptions
svn: r5201
This commit is contained in:
parent
a875550db1
commit
38e189191f
@ -335,16 +335,19 @@ 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 = []
|
||||||
f = open("/etc/xearth/xearth.markers")
|
try:
|
||||||
l = f.readline()
|
f = open("/etc/xearth/xearth.markers")
|
||||||
#linere = re.compile('[^0-9.-]*(-?[0-9]+\.[0-9]+)[^0-9.-]*(-?[0-9]+\.[0-9]+).*"([^"])".*', "I")
|
|
||||||
while l:
|
|
||||||
if not l[0] == "#":
|
|
||||||
l = l.strip().replace('"',"").replace(" "," ").replace(" "," ").replace(" "," ").replace(" # ",", ")
|
|
||||||
m = l.split( None, 2)
|
|
||||||
if len(m) == 3:
|
|
||||||
data.append( (m[2],float(m[1]),float(m[0])))
|
|
||||||
l = f.readline()
|
l = f.readline()
|
||||||
|
#linere = re.compile('[^0-9.-]*(-?[0-9]+\.[0-9]+)[^0-9.-]*(-?[0-9]+\.[0-9]+).*"([^"])".*', "I")
|
||||||
|
while l:
|
||||||
|
if not l[0] == "#":
|
||||||
|
l = l.strip().replace('"',"").replace(" "," ").replace(" "," ").replace(" "," ").replace(" # ",", ")
|
||||||
|
m = l.split( None, 2)
|
||||||
|
if len(m) == 3:
|
||||||
|
data.append( (m[2],float(m[1]),float(m[0])))
|
||||||
|
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
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user