Use of Mapbox token

In the Plotly Express graphics demo, the first block of code in the Maps section, the following gives an error:

 import plotly.express as px
 px.set_mapbox_access_token(open(".mapbox_token").read())  
 carshare = px.data.carshare()

FileNotFoundError Traceback (most recent call last)
in
1 import plotly.express as px
----> 2 px.set_mapbox_access_token(open(".mapbox_token").read())
3 carshare = px.data.carshare()

What can I do to correct the error?

If you have Dash 1.2 (with plotly.js 1.49) you don’t actually need a mapbox token to use a mapbox plot - it won’t use mapbox tiles - it’ll use OpenStreetMap instead. So you can just omit that px.set_mapbox_access_token line.

If you DO want mapbox tiles, you will need to get a token from mapbox, put it somewhere - we put it in a separate file for demos so we don’t need to include the token in our code, but if you’re not going to share your code you can just put it as a string in the code.