Search code examples
pythonplotly-dashdashboard

AttributeError: 'Dash' object has no attribute 'run' in Python/Plotly-DASH


I am new in python and dashboard building so I am trying to print a phylogenetic tree with dash. But I encounter the following problem AttributeError: 'Dash' object has no attribute 'run' as soon as I try to run the app. I know my code probably is problematic but this error in this case seems that dash is not capable to run applications. `def main(): …#extracting the OG code of the corresponfing gene tree return OG

def gene_tree(OG,search_path): …“”“reads and prints a newick file with Phylo.read’”“” return gene_tree

def species_tree(): …“”“reads and prints the species tree with Phylo.read”“” return species_tree

app = Dash(__name__)

app.layout = html.Div(children = [
    html.H1(children="My APP",style={
        "textAlign": "center"
    }),
    html.Div(children="""
    Visualization of gene trees and orthogroups
    """),
    dcc.Graph(
        id= "species-tree",
        figure=species_tree())])
#@app.callback(Output = "id",
              ##Output = "children",
              #Output = "figure"
              #)

if __name__ == "__main__":
    app.run.server(debug=True) #port=8050)

`


Solution

  • It should be one method, run_server:

    if __name__ == '__main__':
        app.run_server(debug=True)