update to python3

alfred-data
Nils Schneider 2012-06-05 17:40:21 +02:00
parent 9a2b79cb60
commit 33ba6a6d33
3 changed files with 5 additions and 16 deletions

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
# TODO
# Gatewayliste
@ -36,4 +36,4 @@ db.import_wikigps("http://freifunk.metameute.de/Knoten")
m = GeoMapBuilder(db)
print(m.build().encode("utf8"))
print(m.build())

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
# TODO
# Gatewayliste

View File

@ -3,18 +3,7 @@ from node import Node
from link import Link
from bs4 import BeautifulSoup
# Python2/3 compatiblity hacks
try:
from urllib.request import urlopen
except ImportError:
from urllib import urlopen
try:
basestring
except NameError:
basestring = str
from urllib.request import urlopen
class NodeDB:
def __init__(self):
@ -170,7 +159,7 @@ class NodeDB:
data = []
def maybe_strip(x):
if isinstance(x.string, basestring):
if isinstance(x.string, str):
return x.string.strip()
else:
return ""