Program paused with no erros and browser did not open

I am here writing my first question after I tried a ready-to-use code on my laptop on Python (SPyder IDE). The link to the code is: https://github.com/Coding-with-Adam/Dash-by-Plotly/blob/master/Other/Dash_Introduction/intro.py This is first time I trying to run a dash program.

I just now installed the dash, restarted my IDE. I downloaded this dash code and input data file. I ran this code but I see no errors (I do see Warnings) in my kernel. However, it hung at the same place for very long (10 min) and did not move further. What could be wrong? It ran and gave output in 2s when the same code was executed by the owner in a youtube video.

Screenshot:

Hi,

Welcome to the community!

What do you mean by paused? It looks like the application is running without errors… Does the app open in the browser in the url http://127.0.0.1:8050 ?

Hi,

Thanks!

No, It did not open in the browser. It remained like that forever until I interrupted after 30 min. I asked the same question in StackOverflow. I was told to type localhost:8050/ in the browser with the program paused like that as in the screenshot. Surprisingly, the plot appeared in the browser. I was shocked. I could not understand why my program failed to open it in the browser until my manual intervention. Any clue and how to solve it. Even now, I am doing the same thing.

I don’t use Spyder, but usually you have to set your IDE in order to make the app open automatically in the browser. Note that this is a different behaviour than just Plotly charts, which will open in the IDE or browser automatically.

Is this this what you meant by “pausing”?

Thanks. How do I set my IDE to make the app open automatically? I am curious to know if the dash app is different than plotly opening the plot in the browser?

Dash browser (or app?) screenshot:

Dash browser (or app?) opens a new window each time I select an option from the dropdown. Screenshot:

Plotly opening the plot in the browser (from my other code, not related to this). Screenshot:

I still don’t see the difference between the dash and plotly plots except that the former has localhost and the latter has http://127.0.0.1:1424/ in the browser address. Am I missing something here?

localhost and 127.0.0.1 are essentially the same thing: the former is just the name address of the latter. So you can open the Dash app in both localhost:8050 or 127.0.0.1:8050.

There is a big difference in open a plotly figure or a Dash application in the browser. In the first case, there isn’t actually a server you can make requests to. The address/port is just used to send the html once to the browser. In a Dash app the server remains open to receive requests, for instance, when you select a new value in the dropdown and the server responds by updating the figure or other components in the application (defined in the callbacks).

I don’tknow how to answer the questions specific to Spyder… maybe @adamschroeder knows, if he’s using it for the videos. I can tell how to do in VS Code, if anyone is interested.

1 Like

Hi, I learned today from you something very important which I did not know before. That is,

Plotly plot: it is a static plot and printed directly to the HTML browser, not from the server. We can interact with the plot.

Das plot: it is a dynamic plot browsed from the HTML browser and it is saved on the server. By selecting a new value (from the dropdown menu), the server responds with a new plot. Here, we are interacting with the plot that is saved on the server, not the python program.

Thanks a lot.

Now, I need to know how to fix my Spyder IDE displays the dash app directly without my intervention.

hi @Msquare
Unfortunately, I don’t use Spyder for my coding. But feel free to write me a personal message with the direct issue at hand. I’ll try to download Spyder and replicate the problem on my computer when I have more time later in the week.