From: Roman Bazalevskiy Date: Tue, 4 Jul 2017 06:32:48 +0000 (+0300) Subject: Bug fixes X-Git-Url: https://git.rvb.name/pyrungps.git/commitdiff_plain/68b3fe33b18c37bbe42cfa588c4c469bff4c0d8e?hp=7b110d16b72ee2c5ce13a2a45de656390526ce81 Bug fixes --- diff --git a/pyosmname.py b/pyosmname.py index 7140f9f..b64d4ea 100644 --- a/pyosmname.py +++ b/pyosmname.py @@ -8,7 +8,7 @@ from lxml import etree def GetXMLDescr(lat,lon): - req = urllib2.Request("http://nominatim.openstreetmap.org/reverse?lat=%s&lon=%s&accept-language=ru,en" %(lat,lon), None, {'User-agent': 'Mozilla/5.0'}) + req = urllib2.Request("http://nominatim.openstreetmap.org/reverse?lat=%s&lon=%s&accept-language=ru,en" %(lat,lon), None) page = urllib2.urlopen(req).read() return etree.fromstring(page) diff --git a/pyrungps.py b/pyrungps.py index 58dd344..62afae7 100644 --- a/pyrungps.py +++ b/pyrungps.py @@ -43,6 +43,7 @@ def sync_folder(username,year,month,dir=".",verbose=False,force=False): for tr in training_list: filename = "%s/%04d/%02d/%s_%s.gpx" % (dir,year,(month+1),tr[0],tr[1]) + dirname = "%s/%04d/%02d" % (dir,year,(month+1)) if os.path.exists(filename) and not force: @@ -50,7 +51,12 @@ def sync_folder(username,year,month,dir=".",verbose=False,force=False): print "training %s exists, skipping" % (filename) else: - + + try: + os.mkdir(dirname) + except: + None + xml=get_gpx_track(tr[1],tr[0]) if verbose: