Using ZODB database in very simple Dash app

Hey all,

I am new to using plotly and dash, and I’m in need of a bit of assistance. I’ve got an object-oriented database that I’ve built using ZODB, and I am wanting to build an app that allows me to visualize some of the data in my ZODB database.

When I attempt to do so, however, I get a “LockError” exception on my db object.

Here is my entire script:

#Fetch the database file, and open a connection to the database
storage = ZODB.FileStorage.FileStorage("test.fs")
db = ZODB.DB(storage)
db_connection = db.open()
db_root = db_connection.root

app = dash.Dash(__name__)

list_group = dbc.ListGroup(
    [
        dbc.ListGroupItem("Active item", active=True),
        dbc.ListGroupItem("Item 2"),
        dbc.ListGroupItem("Item 3"),
    ]
)

app.layout = html.Div(children=[
    html.H1(children='Database Viewer'),
    list_group
])

app.run_server(debug=True)

The error I am receiving is:

Exception has occurred: LockError
Couldn't lock 'test.fs.lock'

I’ve been able to successfully open the database and plot some data if I only use plotly express and not dash. For example, the following does work:

import plotly.express as px

storage = ZODB.FileStorage.FileStorage("test.fs")
db = ZODB.DB(storage)
db_connection = db.open()
db_root = db_connection.root

#Imagine there is some code right here that does some data analysis....

fig = px.bar(df, x="x var", y="y var", color="another var", title="My title")
fig.show()

Therefore, it seems to be something related to Dash. My development environment is Visual Studio Code, using Python 3.8.5 and Miniconda.

Thanks for any help you can provide!