Posted by: matthew_k
GPSapp python script: Invalid Literal for Float - 26/05/2003 17:12
I'm trying to get GPSapp working, and need to create a route file. This is a basic route from my house to best buy, about 15 minutes away. I've tried two other routes using compleetly different starting and ending points., and they all gave the same result. I'm not a python guy, so I have no idea what could be wrong... I've attached the route file, and this is what the script outputs:
[mkocher@ih-ws1 gpsapp-0.17]$ ./parse_mapsonus.py bestbuy.html
['START', '-122.24865', '37.86942', '{MARK.START}', 'Start', 'Point', '(2', 'Panoramic', 'Way,', 'Berkeley,', 'CA)']
['END', '-122.28859', '37.81677', '{MARK.END}', 'End', 'Point', '(Mandela', 'Pkwy,', 'oakland,', 'CA)']
['END', '--></center><br><br>', '<center>', '<table', 'width="90%"', 'cellpadding="0"', 'cellspacing="0"', 'border="0">', '<tbody><tr><td', 'colspan="2"><hr', 'width="90%"', 'align="center"></td>', '</tr>', '<tr><td>\xa0</td><td><br><div', 'class="s12"', 'align="center">', '<a', 'href="http://mapsonus.switchboard.com/">Home</a>', '|', '<a', 'href="http://mapsonus.switchboard.com/auxcgi/MenuFrameLR.cgi/usr=%7E3ed2a72b.5c826.6afd.6/c=6?Url=/doc/maps.aboutus.cgi&Title=About+Us">About', 'Us</a>', '|', '<a', 'href="http://mapsonus.switchboard.com/auxcgi/MenuFrameLR.cgi/usr=%7E3ed2a72b.5c826.6afd.6/c=6?Url=/marketing/contactus.html&Title=Contact+Us">Contact', 'Us</a>', '|', '<a', 'href="http://mapsonus.switchboard.com/doc/makemap.html">Link', 'To', 'Us</a>', '|', '<a', 'href="http://mapsonus.switchboard.com/auxcgi/MenuFrameLR.cgi/usr=%7E3ed2a72b.5c826.6afd.6/c=6?Url=/marketing/advertise.cgi&Title=Advertising">Advertise</a>', '|', '<a', 'href="http://mapsonus.switchboard.com/auxcgi/MenuFrameLR.cgi/usr=%7E3ed2a72b.5c826.6afd.6/c=6?Url=/doc/maps.privacy.cgi&Title=Privacy+Policy">Policies</a>\xa0\xa0\xa0</div><br>', '<div', 'class="s11"', 'align="left">', '</div></td>', '</tr>', '<tr><td', 'colspan="2"', 'align="center"><img', 'src="bestbuy_files/Space.gif"', 'width="630"', 'height="1"', 'border="0"></td></tr>', '<tr><td>\xa0</td>', '<td', 'align="center">', '<div', 'class="s12"', 'align="center">', '<font', 'size="-2"', 'face="arial,helvetica">', '<br>', '<a', 'href="http://www.databyacxiom.com/"><img', 'src="bestbuy_files/acxiom.gif"', 'alt="Data', 'by', 'Acxiom"', 'border="0"', 'width="82"', 'height="12"></a>', '<br><br>', '</font>', 'Map', 'data', 'copyright', 'Tele', 'Atlas', 'North', 'America,', 'Inc,', '1984-2003;', 'use', 'subject', 'to', '<a', 'href="http://mapsonus.switchboard.com/auxcgi/MenuFrameLR.cgi/usr=%7E3ed2a72b.5c826.6afd.6/c=6?Url=/doc/endUserLicense.html&Title=License+Agreement"', 'target="_top">license\xa0agreement</a>.', '<br><br><a', 'href="http://mapsonus.switchboard.com/auxcgi/MenuFrameLR.cgi/usr=%7E3ed2a72b.5c826.6afd.6/c=6?Url=/doc/endUserLicense.html&Title=License+Agreement"', 'target="_top">Copyright</a>', '\xa9', '1996-2003', '<a', 'href="http://www.switchboard.com/">Switchboard', 'Incorporated</a>.', 'All', 'Rights', 'Reserved.', '<br>Switchboard', 'is', 'a', 'registered', 'service', 'mark', 'of', '<a', 'href="http://www.switchboard.com/">Switchboard', 'Inc</a>.', '<br><br>', '</div>', '</td>', '</tr>', '</tbody></table>', '</center></td></tr>', '</tbody></table>', '</body></html>']
Traceback (most recent call last):
File "./parse_mapsonus.py", line 105, in ?
wpoints = parse(inname)
File "./parse_mapsonus.py", line 39, in parse
long = float(parts[1])
ValueError: invalid literal for float(): --></center><br><br>
[mkocher@ih-ws1 gpsapp-0.17]$ ./parse_mapsonus.py bestbuy.html
['START', '-122.24865', '37.86942', '{MARK.START}', 'Start', 'Point', '(2', 'Panoramic', 'Way,', 'Berkeley,', 'CA)']
['END', '-122.28859', '37.81677', '{MARK.END}', 'End', 'Point', '(Mandela', 'Pkwy,', 'oakland,', 'CA)']
['END', '--></center><br><br>', '<center>', '<table', 'width="90%"', 'cellpadding="0"', 'cellspacing="0"', 'border="0">', '<tbody><tr><td', 'colspan="2"><hr', 'width="90%"', 'align="center"></td>', '</tr>', '<tr><td>\xa0</td><td><br><div', 'class="s12"', 'align="center">', '<a', 'href="http://mapsonus.switchboard.com/">Home</a>', '|', '<a', 'href="http://mapsonus.switchboard.com/auxcgi/MenuFrameLR.cgi/usr=%7E3ed2a72b.5c826.6afd.6/c=6?Url=/doc/maps.aboutus.cgi&Title=About+Us">About', 'Us</a>', '|', '<a', 'href="http://mapsonus.switchboard.com/auxcgi/MenuFrameLR.cgi/usr=%7E3ed2a72b.5c826.6afd.6/c=6?Url=/marketing/contactus.html&Title=Contact+Us">Contact', 'Us</a>', '|', '<a', 'href="http://mapsonus.switchboard.com/doc/makemap.html">Link', 'To', 'Us</a>', '|', '<a', 'href="http://mapsonus.switchboard.com/auxcgi/MenuFrameLR.cgi/usr=%7E3ed2a72b.5c826.6afd.6/c=6?Url=/marketing/advertise.cgi&Title=Advertising">Advertise</a>', '|', '<a', 'href="http://mapsonus.switchboard.com/auxcgi/MenuFrameLR.cgi/usr=%7E3ed2a72b.5c826.6afd.6/c=6?Url=/doc/maps.privacy.cgi&Title=Privacy+Policy">Policies</a>\xa0\xa0\xa0</div><br>', '<div', 'class="s11"', 'align="left">', '</div></td>', '</tr>', '<tr><td', 'colspan="2"', 'align="center"><img', 'src="bestbuy_files/Space.gif"', 'width="630"', 'height="1"', 'border="0"></td></tr>', '<tr><td>\xa0</td>', '<td', 'align="center">', '<div', 'class="s12"', 'align="center">', '<font', 'size="-2"', 'face="arial,helvetica">', '<br>', '<a', 'href="http://www.databyacxiom.com/"><img', 'src="bestbuy_files/acxiom.gif"', 'alt="Data', 'by', 'Acxiom"', 'border="0"', 'width="82"', 'height="12"></a>', '<br><br>', '</font>', 'Map', 'data', 'copyright', 'Tele', 'Atlas', 'North', 'America,', 'Inc,', '1984-2003;', 'use', 'subject', 'to', '<a', 'href="http://mapsonus.switchboard.com/auxcgi/MenuFrameLR.cgi/usr=%7E3ed2a72b.5c826.6afd.6/c=6?Url=/doc/endUserLicense.html&Title=License+Agreement"', 'target="_top">license\xa0agreement</a>.', '<br><br><a', 'href="http://mapsonus.switchboard.com/auxcgi/MenuFrameLR.cgi/usr=%7E3ed2a72b.5c826.6afd.6/c=6?Url=/doc/endUserLicense.html&Title=License+Agreement"', 'target="_top">Copyright</a>', '\xa9', '1996-2003', '<a', 'href="http://www.switchboard.com/">Switchboard', 'Incorporated</a>.', 'All', 'Rights', 'Reserved.', '<br>Switchboard', 'is', 'a', 'registered', 'service', 'mark', 'of', '<a', 'href="http://www.switchboard.com/">Switchboard', 'Inc</a>.', '<br><br>', '</div>', '</td>', '</tr>', '</tbody></table>', '</center></td></tr>', '</tbody></table>', '</body></html>']
Traceback (most recent call last):
File "./parse_mapsonus.py", line 105, in ?
wpoints = parse(inname)
File "./parse_mapsonus.py", line 39, in parse
long = float(parts[1])
ValueError: invalid literal for float(): --></center><br><br>