Beginners question

HI Everyone,

this is my first post. I’m trying to learn from plotly tutorials but i consistently get an error message when i run the demo code. The message from pycharm is “socket.gaierror: [Errno -5] No address associated with hostname”.

It appears to be related to the last line of code, specifically “if name == “main”:
app.run_server(debug=True)”.

The code obviously runs fine for other people, so I’m confused as to why it won’t run for me. My python version is 3.9. I’m using pycharm as the IDE. my OS is ubuntu.

This is probably a problem with a really obvious answer, but I’ve been unable to find it so far.
Thank you in advance for your advice

Hi @mkingston

I haven’t seen that error, but did you forget the double underscores?


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

Hi,
Thank you for taking the time to reply and sorry to be so slow in my response! In answer to your question, i definitely have the double underscores.

To make things even stranger, at some point in my efforts i managed to get the code to run and the dashboards to display. I don’t know how I did it, and unfortunately have not been able to repeat it.

Its incredibly frustrating but it probably also shows that the problem is entirely due to the ignorance of the user.

I’ve attached a screenshot of the output from pycharm. If you have any advice I’d really appreciate it.

Hi,
I’ve found a solution of sorts. If i manually set the host and port, it works. I just don’t know why, which bothers me. If anyone can shed any light on this i’d really appreciate it.

Code previously looked like this:

if name == ‘main’:
app.run_server(debug=True)

the code crashed constantly. When I changed it to this:

if name == ‘main’:
app.run_server(host=‘127.0.0.1’, port=‘8050’, debug=True)

The code runs beautifully.

I suppose i should just be glad it works, but i’d really like to understand why.
M