blob: 4fc1cc547b4c8c54ee738a173049999e32747a19 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
import xml.etree.ElementTree as xmlp
import re
def gpxparsing():
try:
tree=xmlp.parse('f.gpx')
root=tree.getroot()
filename=root[1][0].text+".gpx"
os.rename('f.gpx',filename)
except OSError, e:
print("Operating System error: {0}".format(e))
except xml.etree.ElementTree.ParseError,e:
print("Something occured with the formating:{0} . File is not retrievable, passing on next download.".format(e))
os.remove('f.gpx')
pass
return filename
def kmlparsing():
try:
tree=xmlp.parse('f.kml')
root=tree.getroot()
filename= root[0][10][1][0].text+".kml"
except OSError, e:
print("Operating System error: {0}".format(e))
except xml.etree.ElementTree.ParseError,e:
print("Something occured with the formating:{0} . File is not retrievable, passing on next download.".format(e))
os.remove('f.kml')
pass
return filename
def trkparsing():
try:
tree=xmlp.parse('f.gpx')
root=tree.getroot()
filename=root[1][0].text+".gpx"
os.rename('f.gpx',filename)
except OSError, e:
print("Operating System error: {0}".format(e))
except xml.etree.ElementTree.ParseError,e:
print("Something occured with the formating:{0} . File is not retrievable, passing on next download.".format(e))
os.remove('f.gpx')
pass
return filename
|