12
12
BUGS:
13
13
* devcloud tag get's shortend, firefox&co cannot cope with it :( ... make it full again
14
14
"""
15
+ from __future__ import print_function
15
16
16
17
import xml .dom .minidom as minidom
17
18
from xml .dom .minidom import parse , parseString
@@ -180,9 +181,9 @@ def getGeo(loc):
180
181
"""
181
182
loc = loc .replace (" " , "+" )
182
183
loc = urllib2 .quote (loc .encode ('UTF-8' ))
183
- print loc , ">>>" ,
184
+ print ( loc , ">>>" , end = "" )
184
185
global timeout
185
- print "[doing query, %s secs break] >>>" % timeout ,
186
+ print ( "[doing query, %s secs break] >>>" % timeout , end = "" )
186
187
sys .stdout .flush ()
187
188
time .sleep (timeout )
188
189
#url = 'http://maps.google.com/maps/geo?q=%s&output=csv&key=%s' % (loc, gkey)
@@ -199,7 +200,7 @@ def getGeo(loc):
199
200
loc = geo ["results" ][0 ]["geometry" ]["location" ]
200
201
lng = str (loc ["lng" ])
201
202
lat = str (loc ["lat" ])
202
- print acc , lat , lng
203
+ print ( acc , lat , lng )
203
204
return "200" , acc , lng , lat
204
205
205
206
@@ -209,19 +210,19 @@ def addGeo(place):
209
210
if not lcache :
210
211
geo = getGeo (place )
211
212
while geo is None and attempts > 0 :
212
- print "[no result, trying again] >>>" ,
213
+ print ( "[no result, trying again] >>>" , end = "" )
213
214
sys .stdout .flush ()
214
215
geo = getGeo (place )
215
216
attempts -= 1
216
217
if geo is None and attempts == 0 :
217
- print "FAILURE AFTER TOO MANY ATTEMPTS"
218
+ print ( "FAILURE AFTER TOO MANY ATTEMPTS" )
218
219
return
219
220
g = outxml .createElement ("loc" )
220
221
statuscode = geo [0 ]
221
222
# http://code.google.com/apis/maps/documentation/reference.html#GGeoStatusCode
222
223
# 620 means too fast, we need to slow down!
223
224
if "620" == statuscode :
224
- print "we were too fast, error code 620 by google!"
225
+ print ( "we were too fast, error code 620 by google!" )
225
226
global timeout
226
227
timeout *= 2
227
228
addGeo (place )
@@ -234,7 +235,7 @@ def addGeo(place):
234
235
g .setAttribute ("loclat" , geo [3 ])
235
236
out .appendChild (g )
236
237
else :
237
- print "cache"
238
+ print ( "cache" )
238
239
out .appendChild (lcache )
239
240
240
241
@@ -247,34 +248,34 @@ def getStatistics():
247
248
# c.replaceChild(devmap.createTextNode(str(nbContribs)), c.childNodes[0])
248
249
# elif c.getAttribute("id") == "contrib-places":
249
250
# c.replaceChild(devmap.createTextNode(str(nbPlaces)), c.childNodes[0])
250
- print "contributors =" , str (nbContribs ), "places =" , str (nbPlaces )
251
+ print ( "contributors =" , str (nbContribs ), "places =" , str (nbPlaces ) )
251
252
return nbContribs , nbPlaces
252
253
253
254
# read through ack.xml
254
255
for c in ack .getElementsByTagName ("contributor" ):
255
- print c .getAttribute ("name" ), ">>>" ,
256
+ print ( c .getAttribute ("name" ), ">>>" , end = "" )
256
257
if c .hasAttribute ("location" ):
257
258
addGeo (c .getAttribute ("location" ))
258
259
else :
259
- print " <--- UNKNOWN LOCATION !!!"
260
+ print ( " <--- UNKNOWN LOCATION !!!" )
260
261
261
262
262
- print
263
- print "This is now written to file %s:" % geocode_xml_outfn
264
- print out .toprettyxml ()
263
+ print ()
264
+ print ( "This is now written to file %s:" % geocode_xml_outfn )
265
+ print ( out .toprettyxml () )
265
266
266
267
#xml.dom.ext.PrettyPrint(out, open(geocode_xml_outfn, "w"))
267
268
out .writexml (utils .UnicodeFileWriter (open (geocode_xml_outfn , "w" )), newl = "\n " )
268
269
269
- print
270
- print "calculating statistics and writing to description"
270
+ print ()
271
+ print ( "calculating statistics and writing to description" )
271
272
nbContribs , nbPlaces = getStatistics ()
272
273
273
- print
274
- print "now writing table entries for search engines and javascript disabled ones"
274
+ print ()
275
+ print ( "now writing table entries for search engines and javascript disabled ones" )
275
276
writeToDevmap ()
276
277
277
- print "file written to %s" % devmap_tmpl
278
+ print ( "file written to %s" % devmap_tmpl )
278
279
#xml.dom.ext.PrettyPrint(devmap, open(devmap_xml, "w"))
279
280
#devmap.writexml(utils.UnicodeFileWriter(open(devmap_tmpl, "w")), newl="\n")
280
281
# utils.delFirstLine(devmap_xml)
0 commit comments