I'm writing some code with Python and Vincent to display some map data.
The example from the docs looks like this:
import vincent
county_topo = r'us_counties.topo.json'
state_topo = r'us_states.topo.json'
geo_data = [{'name': 'counties',
'url': county_topo,
'feature': 'us_counties.geo'},
{'name': 'states',
'url': state_topo,
'feature': 'us_states.geo'}]
vis = vincent.Map(geo_data=geo_data, scale=3000, projection='albersUsa')
del vis.marks[1].properties.update
vis.marks[0].properties.update.fill.value = '#084081'
vis.marks[1].properties.enter.stroke.value = '#fff'
vis.marks[0].properties.enter.stroke.value = '#7bccc4'
vis.to_json('map.json', html_out=True, html_path='map_template.html')
Running this code outputs an html file, but it's formatted improperly. It's in some kind of python string representation, b'<html>....</html>'
.
If I remove the quotes and the leading b, the html page works as expected when run through the built in python server.
What's wrong with my output statement?