Black Lives Matter. Please consider donating to Black Girls Code today.

No error message, just won't run

Hello all! I’m trying to work through the tutorials starting here.

I absolutely can’t get that very first code chunk to run. At all. No error message, just doesn’t run. I’ve tried several different IDEs. Reinstalled Dash. Eventually got frustrated and copied and pasted the code instead of typing it myself. I just get returned to the user prompt. It ran fine when I tried it last week.

I know that’s not the best way to ask for help as I’m not including many details, but I have no idea what else to tell you.

Can anyone think of any reason for this?


What is the output displayed in the console? If you navigate to what happens?

Pasting your code here (via markdowns) greatly helps the community provide feedback.

Thank you for your prompt response!

I meant to paste my code but got distracted by something shiny.

I’m used to being able to click on a link that comes up in the terminal. No link. When I open a browser and enter I get this site cannot be reached.

This is all the output I’m getting:
PS C:\Users\erica> conda activate base
PS C:\Users\erica> & ‘D:\Users\erica\Anaconda3\python.exe’ ‘c:\Users\erica.vscode\extensions\ms-python.python-2020.2.64397\pythonFiles\lib\python\new_ptvsd\wheels\ptvsd\launcher’ ‘c:\Users\erica\Documents\Dash\’
PS C:\Users\erica>

import dash
import dash_core_components as dcc
import dash_html_components as html

external_stylesheets = ['']

app = dash.Dash(__name__, external_stylesheets=external_stylesheets)

app.layout  = html.Div(children=[
    html.H1(children='Hello Dash'),

        Dash: A web application framework from Python

            'data': [
                {'x': [1, 2, 3], 'y': [4, 1, 2], 'type': 'bar', 'name': 'SF'},
                {'x': [1, 2, 3], 'y': [2, 4, 5], 'type':'bar', 'name': 'Montreal'},
            'layout': {
                'title':'Dash Data Viz'

if __name__ == 'main':

Your if statement isn’t being satisifed. Change
if __name__ == 'main'
__name__ == '__main__'

You can test this out via the following, placing the contents below in a file (i.e.

# program to execute  
# main directly 
print("Always executed")

if __name__ == "main":
    print("If clause reached")
    print("Else clause reached")

If you invoke via python, the Else clause reached statement will be printed. Editng the file to change "main" to "__main__" will cause "if claused reached" to be printed.

That did it! Thank you!

1 Like