From 68b3fe33b18c37bbe42cfa588c4c469bff4c0d8e Mon Sep 17 00:00:00 2001 From: Roman Bazalevskiy Date: Tue, 4 Jul 2017 09:32:48 +0300 Subject: [PATCH] Bug fixes --- pyosmname.py | 2 +- pyrungps.py | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) 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: -- 2.34.1